- 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 4378 Articles for MySQL
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
255 Views
Let us first create a table −mysql> create table DemoTable1349 -> ( -> ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ProductPrice int -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1349(ProductPrice) values(7644); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable1349(ProductPrice) values(90843); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable1349(ProductPrice) values(9083); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1349(ProductPrice) values(10000); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
177 Views
Following is the syntax −select * from yourTableName order by yourColumnName=0, yourColumnName;Let us first create a table −mysql> create table DemoTable1348 -> ( -> Amount int -> ); Query OK, 0 rows affected (0.80 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1348 values(100); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1348 values(0); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1348 values(90); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1348 values(45); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1348 values(0); Query ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
439 Views
For this, you can use the join concept. Let us first create a table −mysql> create table DemoTable1 -> ( -> Id int, -> Name varchar(10) -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(100, 'Bob'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable1;This will produce the following output −+------+------+ | Id | Name | +------+------+ | 100 | Bob | +------+------+ 1 row in set (0.00 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
387 Views
Let us first create a table −mysql> create table DemoTable1345 -> ( -> UserEmailAddress text -> ); Query OK, 0 rows affected (0.42 sec)Insert some records in the table using insert command. We have inserted email address here −mysql> insert into DemoTable1345 values('Carol123@gmail.com'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1345 values('987Sam@gmail.com'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1345 values('David_Miller@gmail.com'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1345 values('Bob@gmail.com'); Query OK, 1 row affected (0.14 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)
235 Views
For this, use group by. Let us first create a table −mysql> create table DemoTable1344 -> ( -> `SequenceId` int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ClientId int, -> isMarried tinyint(1) -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1344(ClientId, isMarried) values(4567, 0); Query OK, 1 row affected (0.45 sec) mysql> insert into DemoTable1344(ClientId, isMarried) values(9876, 0); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1344(ClientId, isMarried) values(5432, 1); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1344(ClientId, isMarried) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
209 Views
Let us first create a table −mysql> create table if not exists DemoTable1343 -> ( -> `_ClientId` int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ClientName varchar(40), -> ClientProjectDeadline date -> )ENGINE=MyISAM, AUTO_INCREMENT=1000; Query OK, 0 rows affected (0.21 sec)Insert some records in the table using insert command with a single query −mysql> insert into DemoTable1343(ClientName, ClientProjectDeadline) values('Chris', '2019-09-24'), ('Bob', '2015-12-09'), -> ('Mike', '2017-01-20'), ('Carol', '2018-03-31'); Query OK, 4 rows affected (0.10 sec) Records: 4 Duplicates: 0 Warnings: 0Display all records from the table using select statement −mysql> select * from DemoTable1343;This will produce the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
255 Views
For this, you can use MySQL row_number(). Let us first create a table −mysql> create table DemoTable1342 -> ( -> Score int -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1342 values(80); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1342 values(98); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1342 values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1342 values(89); Query OK, 1 row affected (0.07 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)
1K+ Views
To fetch the substring after last dot, use substring_index(). Let us first create a table −mysql> create table DemoTable1341 -> ( -> Value varchar(60) -> ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1341 values('John.123.@gmail.com' ); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1341 values('Carol.Taylor.gmail') ; Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1341 values('C.MyFolder.Location') ; Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select * from DemoTable1341;This will produce the following ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
789 Views
Let us first create a table −mysql> create table DemoTable1340 -> ( -> Deadline date -> ); Query OK, 0 rows affected (0.43 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1340 values('2019-09-18'); Query OK, 1 row affected (0.52 sec) mysql> insert into DemoTable1340 values('2019-09-23'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1340 values('2018-12-24'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1340 values('2016-11-01'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1340 values('2019-09-28'); Query OK, 1 row affected (0.18 sec)Display all records from the table ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
218 Views
Let us first create a table −mysql> create table DemoTable1339 -> ( -> Name varchar(30), -> Score int -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1339 values('Chris', 56); Query OK, 1 row affected (0.36 sec) mysql> insert into DemoTable1339 values('Bob', 46); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1339 values('Adam', 78); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1339 values('John', 90); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1339 values('Carol', 98); Query OK, 1 ... Read More