![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL automatic conversion on lowercase? Is this possible?
Yes, it is possible with triggers. You can create trigger for automatic conversion on lower case. Let us first create a table −
mysql> create table DemoTable ( StudentSubject text ); Query OK, 0 rows affected (0.61 sec)
Let us create a trigger for automatic conversion on lower case −
mysql> CREATE TRIGGER lowerCaseOnInsertDemo BEFORE INSERT ON DemoTable FOR EACH ROW SET NEW.StudentSubject = LOWER(NEW.StudentSubject); Query OK, 0 rows affected (0.21 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('MOngoDb'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('JaVA'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('MySqL'); Query OK, 1 row affected (0.15 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output displaying the converted lowercase values −
+----------------+ | StudentSubject | +----------------+ | mongodb | | java | | mysql | +----------------+ 3 rows in set (0.00 sec)
Advertisements