- 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
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
2K+ Views
To remove NULL records in a column, you can use delete command. Following is the syntax −delete from yourTableName where yourColumnName IS NULL;Let us first create a table −mysql> create table removeNullRecordsDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.50 sec)Following is the query to insert records in the table using insert command −mysql> insert into removeNullRecordsDemo values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into removeNullRecordsDemo values(null); Query OK, 1 row affected (0.15 sec) mysql> insert into removeNullRecordsDemo values('Larry'); Query OK, 1 row affected (0.19 sec) ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
274 Views
You can use LPAD() from MySQL to pad the beginning of a MySQL INT field with zeroes. Let us first create a table.mysql> create table paddingDemo -> ( -> Number int -> ); Query OK, 0 rows affected (0.49 sec)Following is the query to insert some records in the table using insert command −mysql> insert into paddingDemo values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into paddingDemo values(560); Query OK, 1 row affected (0.17 sec) mysql> insert into paddingDemo values(888995); Query OK, 1 row affected (0.13 sec) mysql> insert into paddingDemo values(999994); ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
466 Views
In order to remove partial text from value, you can use REPLACE() from MySQL. Following is the syntax −update yourTableName set yourColumnName = replace(yourColumnName ,'yourValue ', '' );Let us first create a table −mysql> create table removePartialTextDemo -> ( -> JavaVersionDetails varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)Following is the query to insert some records in the table using insert command −mysql> insert into removePartialTextDemo values('Java Version 1.0'); Query OK, 1 row affected (0.50 sec) mysql> insert into removePartialTextDemo values('Java Version 1.1'); Query OK, 1 row affected (0.23 sec) mysql> insert into ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
622 Views
For this, use ORDER BY along with GROUP BY clause. Let us first create a table with Student Name and Score −mysql> create table countRowValueDemo -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentMathScore int -> ); Query OK, 0 rows affected (0.71 sec)Following is the query to insert records in the table using insert command −mysql> insert into countRowValueDemo(StudentName, StudentMathScore) values('Larry', 45); Query OK, 1 row affected (0.19 sec) mysql> insert into countRowValueDemo(StudentName, StudentMathScore) values('Mike', 56); Query OK, 1 row affected (0.16 sec) mysql> insert into ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
94 Views
Assume that the date is in varchar data type i.e. not in the date format.Let us first create a table. Following is the query −mysql> create table convertDateDemo -> ( -> AdmissionDate varchar(200) -> ); Query OK, 0 rows affected (0.63 sec)Following is the query to insert some records in the table using insert command −mysql> insert into convertDateDemo values('April 04 2019'); Query OK, 1 row affected (0.18 sec) mysql> insert into convertDateDemo values('May 05 2018'); Query OK, 1 row affected (0.16 sec) mysql> insert into convertDateDemo values('January 01 2012'); Query OK, 1 row affected ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
438 Views
You can display databases sorted by creation date with ORDER BY clause. Following is the query to display all databases −mysql> show databases;This will produce the following output −+---------------------------+ | Database | +---------------------------+ | bothinnodbandmyisam | | business | | commandline | | customer_tracker_database | | customertracker | | database1 | | databasesample | | demo ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
454 Views
Let us first create a table. Following is the query −mysql> create table gettingAndOrderingRowsDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Value int -> ); Query OK, 0 rows affected (1.35 sec)Following is the query to insert some records in the table using insert command −mysql> insert into gettingAndOrderingRowsDemo(Value) values(10); Query OK, 1 row affected (0.33 sec) mysql> insert into gettingAndOrderingRowsDemo(Value) values(13); Query OK, 1 row affected (0.32 sec) mysql> insert into gettingAndOrderingRowsDemo(Value) values(0); Query OK, 1 row affected (0.17 sec) mysql> insert into gettingAndOrderingRowsDemo(Value) values(20); Query OK, 1 ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
698 Views
In order to check a table exists in MySQL, you can use INFORMATION_SCHEMA.TABLES. Let us first create a table −mysql> create table Client_information -> ( -> Id int, -> Name varchar(10) -> ); Query OK, 0 rows affected (0.48 sec)Following is the query to insert some records in the table using insert command −mysql> insert into Client_information values(1, 'Larry'); Query OK, 1 row affected (0.14 sec) mysql> insert into Client_information values(2, 'Mike'); Query OK, 1 row affected (0.17 sec) mysql> insert into Client_information values(3, 'Sam'); Query OK, 1 row affected (0.19 sec)Following is the ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
547 Views
To write stored procedure to insert data into a table, at first you need to create a table −mysql> create table insertDataUsingStoredProcedure -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY , -> Name varchar(20), -> Age int -> ); Query OK, 0 rows affected (0.51 sec)Following is the query to write stored procedure to insert data into the table −mysql> DELIMITER // mysql> CREATE PROCEDURE StoredProcedureInsertData(IN StudentName varchar(100), IN StudentAge int) -> BEGIN -> insert into insertDataUsingStoredProcedure(Name, Age) values (StudentName, StudentAge ); -> END -> // Query OK, 0 ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
383 Views
To get the max value, use the max() function. Let us create a table first −mysql> create table findMaxValueInVarcharField -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Value varchar(200) -> ); Query OK, 0 rows affected (1.09 sec)Following is the query to insert some records in the table using insert command −mysql> insert into findMaxValueInVarcharField(Value) values('200'); Query OK, 1 row affected (0.14 sec) mysql> insert into findMaxValueInVarcharField(Value) values('1000'); Query OK, 1 row affected (0.25 sec) mysql> insert into findMaxValueInVarcharField(Value) values('899474'); Query OK, 1 row affected (0.18 sec) mysql> insert into ... Read More