- 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 4219 Articles for MySQLi
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
119 Views
Use MySQL BETWEEN to fetch a value between different values. Let us first create a table −mysql> create table DemoTable1473 -> ( -> EmployeeCode varchar(20) -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1473 values('EMP_120'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable1473 values('EMP_125'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1473 values('EMP_30'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1473 values('EMP_130'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
251 Views
Let us first create a table. Here, we have declared dates in char type −mysql> create table DemoTable1472 -> ( -> ShippingDate char(35) -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1472 values('12/31/2017 10:50'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1472 values('01/10/2018 12:00'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1472 values('03/20/2019 09:30'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable1472;This will produce the following output ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
332 Views
Let us first create a table −mysql> create table DemoTable1471 -> ( -> EmployeeJoiningDate date, -> EmployeeRelievingDate date -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1471 values('2018-06-21', '2018-12-21'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1471 values('2017-01-19', '2019-01-31'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1471 values('2015-12-31', '2016-03-01'); Query OK, 1 row affected (0.11 sec)Display all records from the table using select statement −mysql> select * from DemoTable1471;This will produce the following output −+---------------------+-----------------------+ | EmployeeJoiningDate | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
83 Views
For this, use COALESCE(). Let us first create a table −mysql> create table DemoTable1470 -> ( -> FirstName varchar(20), -> Age int -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1470 values('Robert', 23); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1470 values('Bob', NULL); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1470 values(NULL, 25); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select * from DemoTable1470;This will produce the following output ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
436 Views
To remove index from a MySQL table, the syntax is as follows −alter table yourTableName drop index `yourIndexName`;Let us first create a table −Mysql> create table DemoTable1469 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(40), -> StudentAge int -> ); Query OK, 0 rows affected (0.78 sec)Following is the query to add index on column name −mysql> create index `Student Name_Index` on DemoTable1469(StudentName); Query OK, 0 rows affected (0.33 sec) Records: 0 Duplicates: 0 Warnings: 0Let us check the table description −mysql> desc DemoTable1469;This will produce the following output −+-------------+-------------+------+-----+---------+----------------+ ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
57 Views
Let us first create a table −mysql> create table DemoTable1468 -> ( -> Id int, -> Name varchar(20), -> Age int -> ); Query OK, 0 rows affected (1.21 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1468 values(100, 'Chris', 23); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1468 values(101, 'Bob', 25); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1468 values(102, 'David', 30); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1468 values(100, 'Chris', 23); Query OK, 1 row affected (0.35 sec) mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
764 Views
For this, you can use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable1467 -> ( -> Id int, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1467 values(100, 'Chris'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1467 values(110, 'David'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1467 values(120, 'Mike'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1467 values(100, 'Chris'); Query OK, 1 row affected (0.12 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
507 Views
Do not use the below query for this −insert into yourTableName values(yourValue1, yourValue2, ...N); insert into yourTableName values(yourValue1, yourValue2, ...N); insert into yourTableName values(yourValue1, yourValue2, ...N); . . . NYou can use below query as the fastest way to insert with multiple values in a single query −insert into yourTableName values(yourValue1, yourValue2, ...N), (yourValue1, yourValue2, ...N), (yourValue1, yourValue2, ...N), ...................N;Let us first create a table −mysql> create table DemoTable1466 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20), -> Age int -> ); Query OK, 0 rows affected (0.98 sec)Insert some records ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
166 Views
Let us first create a table −mysql> create table DemoTable1465 -> ( -> Name varchar(40) -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1465 values('Chris Brown'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1465 values('David Miller'); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable1465 values('John Doe'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable1465;This will produce the following output −+--------------+ | Name | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
You can use stored procedure and can pass the value via parameter. Let us first create a table −mysql> create table DemoTable1464 -> ( -> Id int, -> FirstName varchar(20) -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1464 values(101, 'Chris Brown'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1464 values(102, 'John Doe'); Query OK, 1 row affected (0.09 sec)Display all records from the table using select statement −mysql> select * from DemoTable1464;This will produce the following output −+------+-------------+ | Id ... Read More