- Trending Categories
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
Found 6702 Articles for Database
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
278 Views
To begin auto increment from a specific point, use ALTER command. The syntax is as follows −ALTER TABLE yourTableName auto_increment = anySpecificPoint;To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table AutoIncrementSpecificPoint −> ( −> BookId int auto_increment not null, −> Primary key(BookId) −> ); Query OK, 0 rows affected (0.56 sec)Now you can insert records using insert command.The query is as follows −mysql> insert into AutoIncrementSpecificPoint values(); Query OK, 1 row affected (0.17 sec) ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
1K+ Views
To implement a keyword search in MySQL, you can use LIKE operator. The syntax is as follows −SELECT *FROM yourTableName where yourColumnName Like ‘%anyKeywordName%’ or yourColumnName Like ‘%anyKeywordName%’;To understand it further, let us first create a table. The following is the query to create a table −mysql> create table KeywordSearchDemo −> ( −> StudentId int −> , −> StudentName varchar(100) −> ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using INSERT command. The query to insert record is as follows −mysql> insert into KeywordSearchDemo values(100, 'Adam John'); Query OK, 1 ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
87 Views
The concat operator can be used in ORACLE. MySQL use concat() function to perform concatenation.To understand the concat() function, let us create a table. The query to create a table is as follows −mysql> create table ConcatenationDemo −> ( −> Id int, −> Name varchar(100) −> ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into ConcatenationDemo values(100, 'John'); Query OK, 1 row affected (0.19 sec) mysql> insert into ConcatenationDemo values(101, 'Sam'); Query ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
94 Views
You do not need to use values whenever you insert the results of a select. To insert the results of select, let us first create two tables.The first table query is as follows −< FirstTableDemo> mysql> create table FirstTableDemo −> ( −> StudentId int, −> StudentName varchar(100) −> ); Query OK, 0 rows affected (0.41 sec)Now create second table and after that insert the second table records in the first table using INSERT SELECT command.The query to create the second table − mysql> create table SecondTableDemo −> ( −> Id int, −> ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
93 Views
The MySQL LIMIT is applied after ORDER BY. Let us check the limit condition. Firstly, we will create a table −mysql> create table LimitAfterOrderBy −> ( −> Id int, −> Name varchar(100) −> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into LimitAfterOrderBy values(101, 'John'); Query OK, 1 row affected (0.18 sec) mysql> insert into LimitAfterOrderBy values(102, 'Carol'); Query OK, 1 row affected (0.15 sec) mysql> insert into LimitAfterOrderBy values(103, 'Bob'); Query OK, 1 row affected (0.21 sec) ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
272 Views
MySQL alias cannot be used with *. However, it can be used for individual column. The syntax is as follows −select anyaliasName.yourColumnName1 as anyaliasName1, anyaliasName.yourColumnName2 as anyaliasName2, anyaliasName.yourColumnName3 as anyaliasName3, anyaliasName.yourColumnName4 as anyaliasName4, . . . . N from yourTableName as anyaliasName;MySQL alias is a variable of table that can be used to access the column name of that particular table. To understand the above syntax, let us create a table.The query to create a table is as follows −mysql> create table TableAliasDemo −> ( −> Id int, −> Name varchar(100), −> Age int −> ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
2K+ Views
You can use in-built function STR_TO_DATE() from MySQL. The syntax is as follows −SELECT STR_TO_DATE(CONCAT(yourYearColumName, '-', LPAD(yourMonthColumName, 2, '00'), '-', LPAD(yourDayColumName, 2, '00')), '%Y-%m-%d') as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table DateCreateDemo −> ( −> `Day` varchar(2), −> `Month` varchar(2), −> `Year` varchar(4) −> ); Query OK, 0 rows affected (1.68 sec)Insert values for all fields using insert command. The query is as follows −mysql> insert into DateCreateDemo values('15', '12', '2018'); Query OK, 1 row affected (0.09 ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
220 Views
You can use subquery to order randomly and display name in asending order. The rand() is used for random, whereas ORDER BY is used to display name records in ascending order. The syntax is as follows −select *from ( select *from yourTableName order by rand() limit anyIntegerValue; ) anyVariableName order by yourColumnName;To understand the above concept, let us create a table. We have an ID as sell as Name, which we want in Ascending order. The query to create a table is as follows −mysql> create table OrderByRandName −> ( −> Id int, −> Name varchar(100) ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
694 Views
To compare dates in MySQL except time portion of a datetime field, you can use DATE() function. The syntax is as follows −select *from yourTableName where date(yourColumName) = yourDate;To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table ComparingDate −> ( −> Name varchar(100), −> Login datetime −> ); Query OK, 0 rows affected (0.50 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into ComparingDate values('John', '2014-04-06 22:50:45'); Query OK, 1 row affected ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
1K+ Views
To adjust display settings of MySQL command line, use the /G at the end of MySQL queries instead of semicolon(;).The syntax is as follows −SELECT *FROM yourTableName \GThe above syntax adjusts the display settings. Here we will display records in row format from our sample ‘studenttable’ table which we created using CREATE −mysql> create table StudentTable −> ( −> Id int, −> Name varchar(100) −> ); Query OK, 0 rows affected (0.65 sec)To get all the records −mysql> select *from StudentTable;The following displays the records −+------+---------+ | Id | Name | +------+---------+ | ... Read More