- 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
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
366 Views
Use NOT LIKE for this. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFullName varchar(40) ); Query OK, 0 rows affected (0.66 sec)Insert records in the table using insert command −mysql> insert into DemoTable(StudentFullName) values('JohnSmith'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(StudentFullName) values('John Doe'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(StudentFullName) values('Adam Smith'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(StudentFullName) values('CarolTaylor'); Query OK, 1 row affected (0.19 sec)Display all records from the table using ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
142 Views
You need to use GROUP BY for this. Let us first create a table −mysql> create table DemoTable ( StudentFirstName varchar(20) ); Query OK, 0 rows affected (0.74 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (1.34 sec) mysql> insert into DemoTable values('Carol'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected (0.25 sec) mysql> ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
1K+ Views
If you do not specify unsigned, then bigint will be signed. If you specify an unsigned, then bigint will be unsigned.Let us first create a table −mysql> create table DemoTable ( Number bigint, // signed Number2 bigint unsigned // unsigned ); Query OK, 0 rows affected (1.08 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(18446744073709551615, 18446744073709551615); ERROR 1264 (22003): Out of range value for column 'Number' at row 1 mysql> insert into DemoTable values(9223372036854775807, 18446744073709551615); Query OK, 1 row affected (0.28 sec)Display all records from the table using select statement −mysql> ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
905 Views
In order to check if a table already exists in the database by using MySQL, you can use INFORMATION_SCHEMA.TABLES. Following is the syntax −SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘yourDatabaseName’ AND TABLE_NAME = ’yourTableName’;Let us implement the above syntax in order to check if a table already exists in the database.Case 1: When the table is present −mysql> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sample' AND TABLE_NAME = 'DemoTable';This will produce the following output −+--------------+ | TABLE_NAME | +--------------+ | DemoTable | +--------------+ 1 row in set (0.01 sec)Case 2: When the table is ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
301 Views
You can use REGEXP for this. Let us first create a table −mysql> create table DemoTable ( Value text ); Query OK, 0 rows affected (1.28 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('645st'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable values('765stp'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('665tcp'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('606cpp'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable;This will produce ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
341 Views
You can use BINARY along with the LIKE operator. Let us first create a table −mysql> create table DemoTable ( Header text ); Query OK, 0 rows affected (1.09 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('Programming tutorials on MySQL'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('programming in Java language'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Program in C language'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('pRograMMing in Python language'); Query OK, 1 row affected (0.41 sec)Display ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
83 Views
Use COUNT() for this. Let us first create a table −mysql> create table DemoTable ( StudentFirstName varchar(20) ); Query OK, 0 rows affected (0.53 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('Larry'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Larry'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Larry'); ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
285 Views
To concatenate fields in MySQL, you can use GROUP_CONCAT() along with GROUP BY. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(30), StudentScore int ); Query OK, 0 rows affected (0.51 sec)Insert records in the table using insert command −mysql> insert into DemoTable( StudentName, StudentScore) values('Bob', 80); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable( StudentName, StudentScore) values('Bob', 80); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable( StudentName, StudentScore) values('Chris', 90); Query OK, 1 row affected (0.13 sec) ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
683 Views
You can use RIGHT() function from MySQL to get the last 12 digits from a string. Let us first create a table −mysql> create table DemoTable ( Number varchar(200) ); Query OK, 0 rows affected (0.59 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('7437647847847474374747464647484949959958484'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('9990000399494959697080800007007070808080808'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('1211111212344554444443333345555554433333333333333'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable;This will produce the following ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
4K+ Views
First, you need to open the command prompt. You can open using shortcut windows+R key.The screenshot is as follows −Now type CMD and press OK button −Now the following command prompt would be visible −Now reach the MySQL bin directory. The screenshot is as follows −Following is the query to run MySQL in the command line to create a database −Now you can check the database is created or not using SHOW DATABASES command −mysql> SHOW DATABASES;This will produce the following output −+---------------------------+ | Database | +---------------------------+ | bothinnodbandmyisam ... Read More