![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
AmitDiwan has Published 11365 Articles
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
1K+ Views
Let us first create a table −mysql> create table DemoTable ( FirstName varchar(100), LastName varchar(100) ); Query OK, 0 rows affected (0.92 sec) mysql> alter table DemoTable add index(FirstName, LastName); Query OK, 0 rows affected (1.00 sec) Records: 0 Duplicates: 0 Warnings: 0Insert some records in the table ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
531 Views
For this, use UNION. Let us first create a table −mysql> create table DemoTable ( Name1 varchar(100), Name2 varchar(100) ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert commandmysql> insert into DemoTable values('Adam', 'Bob'); Query OK, 1 row affected (0.21 sec) mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
343 Views
For this, use a CASE statement. Let us first create a table −mysql> create table DemoTable ( Value char(1) ); Query OK, 0 rows affected (1.21 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('a'); Query OK, 1 row affected (0.16 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
223 Views
Yes, we can use INTERVAL while inserting data records. Let us first create a table −mysql> create table DemoTable ( ArrivalTime datetime ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command. Here, we are using INTERVAL keyword for incrementing the date records ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
101 Views
Yes, you can give the year as a column name in MySQL table since it isn’t a reserved word. Let us first create a table −mysql> create table DemoTable ( Year int ); Query OK, 0 rows affected (0.87 sec)Insert some records in the table using insert command −mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
278 Views
To concatenate rows on the basis of boolean value in another column, use GROUP_CONCAT(). Let us first create a table. Here, we have set one of the columns “isValidUser” as BOOLEAN −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserMessage varchar(100), isValidUser boolean ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
86 Views
To ORDER BY letters, use ORDER BY SUBSTRING(). Let us first create a table −mysql> create table DemoTable ( Id varchar(100) ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('456 John Smith'); Query OK, 1 row affected ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
124 Views
To fetch the maximum value, use any of the below-given syntaxes −select max(yourColumnName) from yourTableName; OR select *from yourTableName order by yourColumnName desc limit 1;Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (0.84 sec)Insert some records in the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
390 Views
For alphabetic search, use the REGEX in MySQL. Here, let’s say we are searching for records beginning with A, B or C. The syntax to use REGEXP for the same purpose is as follows −select *from yourTableName where yourColumnName REGEXP '^[ABC]';Let us first create a table −mysql> create table DemoTable ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
458 Views
TRIM is used to remove leading and trailing spaces. Let us first create a table −mysql> create table DemoTable ( StudentName varchar(100) ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command. Here, we have inserted records with leading and trailing whitespaces −mysql> ... Read More