- 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
The optimal solution to select records beginning with certain numbers, use MySQL LIKE operator. Let us first create a table −mysql> create table DemoTable ( ClientId bigint, ClientName varchar(40) ); Query OK, 0 rows affected (0.82 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(23568777, 'Chris Brown'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(9085544, 'John Doe'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(9178432, 'John Doe'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(9078482, 'David Miller'); Query OK, 1 row ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
401 Views
For selective multiple records, use MySQL IN(). To delete them, use MySQL DELETE. Let us first create a table −mysql> create table DemoTable ( ClientId varchar(40), ClientName varchar(50) ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('CLI-101', 'Chris'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('CLI-110', 'Adam'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('CLI-220', 'Mike'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('CLI-120', 'Bob'); Query OK, 1 row affected (0.53 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
For this, use CONCAT() along with LIKE operator. Let us first create a table −mysql> create table DemoTable ( Name varchar(40) ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.33 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values('Johnson'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.12 sec)Display all records ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
785 Views
Let us first see how we can perform NAND/NOR operations in MySQL. The concept is as follows −NAND= NOT( yourColumnName1 AND yourColumnName2) NOR=NOT( yourColumnName1 OR yourColumnName2)Let us first create a table −mysql> create table DemoTable ( Value1 boolean , Value2 boolean ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(true, true); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(false, false); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(false, true); Query OK, 1 row affected (0.10 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
82 Views
Let us first create a table −mysql> create table DemoTable ( BookingDate date ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-09-21'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('2018-09-10'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-09-10'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2019-09-08'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2016-09-18'); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
649 Views
Use GROUP BY with the COUNT() method. Group the names with GROUP BY and count using the COUNT() method. Let us first create a table −mysql> create table DemoTable ( Name varchar(30) ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.07 sec) mysql> insert into ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
58 Views
To populate autocomplete, use the LIKE clause in MySQL. Let us first create a table −mysql> create table DemoTable ( SchoolName varchar(100) ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Horce Greeley'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('Conestoga Senior'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Adlai E.Stevenson'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Thomas Jefferson'); Query OK, 1 row affected (0.07 sec)Display all records from the table using select statement :mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
For this, use GROUP_CONCAT() along with GROUP BY. Here, the GROUP_CONCAT() is used to concatenate data from multiple rows into one field.Let us first create a table −mysql> create table DemoTable ( PlayerId int, ListOfPlayerName varchar(30) ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 'Chris'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(101, 'David'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(100, 'Bob'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(100, 'Sam'); Query ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
129 Views
To display NULL records, use IS NULL in MySQL. To ignore a single value, use the != operator , which is an alias of the operator.Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, PlayerName varchar(40) ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −p>mysql> insert into DemoTable(PlayerName) values('Adam'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(PlayerName) values(NULL); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(PlayerName) values('Sam'); Query OK, 1 row affected (0.13 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
154 Views
Do not use single quotes. You need to use backticks around the table name match, since it is a reserved name in MySQL. Following is the error that occurs :mysql> select *from match; ERROR 1064 (42000) : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match' at line 1Let us first create a table and fix the occurrence of the above error using backticks around the reserved word match, used here as table name −mysql> create table `match` ( Id int NOT ... Read More