
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 4218 Articles for MySQLi

431 Views
Let us first create a table −mysql> create table DemoTable815(Gender BOOLEAN); Query OK, 0 rows affected (0.84 sec)Insert some records in the table using insert command −mysql> insert into DemoTable815 values(true); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable815 values(false); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable815 values(false); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable815 values(true); Query OK, 1 row affected (0.16 sec)Display all records from the table using select statement −mysql> select *from DemoTable815;This will produce the following output −+--------+ | Gender | +--------+ | 1 ... Read More

300 Views
Use INTERVAL to update the days for all the dates in a MySQL table column. Let us first create a table −mysql> create table DemoTable814(ArrivalDate date); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable814 values('2018-12-02'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable814 values('2017-03-12'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable814 values('2019-12-23'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable814 values('2016-06-01'); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable814 values('2019-08-03'); Query OK, 1 row affected (0.20 ... Read More

89 Views
Use GROUP_CONCAT() to perform group concatenation and set a condition. Let us first create a table −mysql> create table DemoTable813( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserFirstName varchar(100), UserLastName varchar(100) ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable813(UserFirstName, UserLastName) values('Adam', 'Smith'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable813(UserFirstName, UserLastName) values('Chris', 'Brown'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable813(UserFirstName, UserLastName) values('David', 'Miller'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable813(UserFirstName, UserLastName) values('Carol', 'Taylor'); Query ... Read More

150 Views
To display results on the basis of keyword, use the LIKE operator as in the following syntax −select *from yourTableName where yourColumnName LIKE '%yourValue%';Let us first create a table −mysql> create table DemoTable812(Comments text); Query OK, 0 rows affected (0.61 sec)Insert some records in the table using insert command −mysql> insert into DemoTable812 values('Good Looking'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable812 values('Awesome'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable812 values('Looking Gorgeous'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable812 values('Good Luck'); Query OK, 1 row affected (0.20 sec) ... Read More

167 Views
Yes, it is enabled by default from MySQL version 4.0. Here, we are using MySQL version 8.0.1 −mysql> select version(); +-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)Let us now check the my.ini wherein the default engine type InnoDB is visible −Let us first create two table. One of them would be set with engine type, whereas the other one won’t be set with the engine type.The first table −mysql> create table DemoTable1(Id int NOT NULL AUTO_INCREMENT PRIMARY KEY); Query OK, 0 rows affected (0.80 sec)The second table set with ENGINE ... Read More

119 Views
Yes, we can insert two or more rows in a table at once. Following is the syntax −insert into yourTableName(yourColumnName1, yourColumnName2) values(yourValue1, yourValue2), (yourValue1, yourValue2), .........N;Let us first create a table −mysql> create table DemoTable811( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(100), StudentAge int ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable811(StudentName, StudentAge) values('Chris', 21), ('Robert', 22), ('David', 20), ('Bob', 19), ('Carol', 23); Query OK, 5 rows affected (0.14 sec) Records: 5 Duplicates: 0 Warnings: 0Display all records from the table using select ... Read More

258 Views
Let us first create a table −mysql> create table DemoTable841( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Value varchar(100) ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert into DemoTable841(Value) values('X'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable841(Value) values('Y'); Query OK, 1 row affected (0.39 sec) mysql> insert into DemoTable841(Value) values('Y'); Query OK, 1 row affected (1.62 sec) mysql> insert into DemoTable841(Value) values('Z'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable841(Value) values('X'); Query OK, 1 row affected (0.81 sec) mysql> insert into ... Read More

95 Views
Let us first create a table −mysql> create table DemoTable810( First int, Second int ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable810 values(20, 40); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable810 values(70, 90); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable810 values(120, 150); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable810 values(78, 128); Query OK, 1 row affected (0.32 sec)Display all records from the table using select statement −mysql> select *from DemoTable810 ;This will produce the ... Read More

859 Views
For this, you can use a session variable. Let us first create a table −mysql> create table DemoTable809(Price int); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable809 values(40); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable809 values(50); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable809 values(60); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable809;This will produce the following output −+-------+ | Price | +-------+ | 40 | | 50 | ... Read More

860 Views
Let’s say the current date is 2019-08-03. Now, we will see an example and create a table −mysql> create table DemoTable840(DueDate datetime); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable840 values('2019-08-9'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable840 values('2019-07-5'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable840 values('2019-08-10'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable840 values('2019-07-13'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select *from DemoTable840;This will produce the ... Read More