- 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)
902 Views
To call a stored procedure, you can use CALL command. Following is the syntax −CALL yourStoredProcedureName(parameter if any);Let us first create a sample procedure. Following is the query to create a stored procedure. Here, we have set two values, one is an INT and another VARCHAR −mysql> DELIMITER // mysql> CREATE PROCEDURE CALL_PROC(Id int, Name varchar(40)) BEGIN SELECT CONCAT('You have entered the Id which is=', Id); SELECT CONCAT('You have entered the Name which is=', Name); END // Query OK, 0 rows affected (0.21 sec) mysql> DELIMITER ;Following is the query to call a stored procedure in ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
To execute multiple select queries in MySQL, use the concept of DELIMITER. Let us first create a table −mysql> create table DemoTable1 ( Title text )ENGINE=MyISAM; Query OK, 0 rows affected (0.30 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values('The database MySQL is less popular than MongoDB') ; Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1 values('Java language uses MySQL database'); Query OK, 1 row affected (0.05 sec) mysql> insert into DemoTable1 values('Node.js uses the MongoDB') ; Query OK, 1 row affected (0.05 sec)Display all records from the table using ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
115 Views
The error is in the syntax of VALUE().Use VALUES() instead of VALUE(). The correct syntax of the insert query is as follows −INSERT INTO yourTableName VALUES(yourValue1, yourValue2, .......N);Let us first create a table −mysql> create table DemoTable ( StudentId int, StudentName varchar(40), StudentAge int ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> INSERT INTO DemoTable VALUES(1001, 'Tom', 20); Query OK, 1 row affected (0.11 sec) mysql> INSERT INTO DemoTable VALUES(1002, 'Mike', 21); Query OK, 1 row affected (0.13 sec) mysql> INSERT INTO DemoTable VALUES(1003, 'Sam', 19); Query OK, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
56 Views
Let us first create a table −mysql> create table DemoTable1 ( EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeName varchar(50) ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1(EmployeeName) values('Tom'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1(EmployeeName) values('Mike'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1(EmployeeName) values('Emma'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1(EmployeeName) values('Sam'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement::mysql> select *from DemoTable1;This will produce the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
838 Views
If you want only the string values, then use the below syntax −select *from yourTableName where yourColumnName NOT regexp '^[0-9]+$';If you want only the digit, then use the below syntax −select *from yourTableName where yourColumnName regexp '^[0-9]+$';Let us first create a table −mysql> create table DemoTable( Id varchar(100) ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('1000'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Carol_Smith'); Query OK, 1 row affected (0.15 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
680 Views
Let us first create a table −mysql> create temporary table DemoTable ( SerialNumber int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command. Here, we are inserting multiple values in a temporary table −mysql> insert into DemoTable values(1),(2),(3),(4),(5),(6),(7),(8); Query OK, 8 rows affected (0.00 sec) Records: 8 Duplicates: 0 Warnings: 0Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------------+ | SerialNumber | +--------------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | +--------------+ 8 rows in set (0.00 sec)
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
48 Views
For this, you can use GROUP_CONCAT() along with DISTINCT. Let us first create a table −mysql> create table DemoTable ( Id int, Subject varchar(40) ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 'MySQL'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(100, 'MongoDB'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(100, 'Java'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(100, 'MongoDB'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(101, 'MySQL'); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
239 Views
For this, you can filter records on the basis of LIKE. Let us first create a table −mysql> create table DemoTable ( Name varchar(50) ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John Smith'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Adam Smith'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Carol'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('David Miller'); Query OK, 1 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
55 Views
For sort by distance, use ORDER BY ABS(). Let us first create a table −mysql> create table DemoTable ( Number int ); Query OK, 0 rows affected (1.16 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.51 sec) mysql> insert into DemoTable values(101); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(102); Query OK, 1 row affected (0.46 sec) mysql> insert into DemoTable values(103); Query OK, 1 row affected (0.84 sec) mysql> insert into DemoTable values(104); Query OK, 1 row affected (0.17 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
107 Views
For this, compare the date records with the current date using the CURDATE() method. Let us first create a table −mysql> create table DemoTable ( RegistrationLastDate datetime ); Query OK, 0 rows affected (0.61 sec)Let’s say the current date is −2019-09-03Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-08-01'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2019-09-03 9:50:56'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('2019-09-03'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('2019-09-02'); Query OK, 1 row affected (0.18 sec) mysql> ... Read More