- 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)
340 Views
Let us first create a table −mysql> create table DemoTable622 (Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Value1 int, Value2 int); Query OK, 0 rows affected (1.08 sec)Insert some records in the table using insert command −mysql> insert into DemoTable622(Value1, Value2) values(1000, 1000); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable622(Value1, Value2) values(2000, 3000); Query OK, 1 row affected (1.04 sec)Display all records from the table using select statement −mysql> select *from DemoTable622;This will produce the following output −+----+--------+--------+ | Id | Value1 | Value2 | +----+--------+--------+ | 1 | 1000 | 1000 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
71 Views
Let us first create a table −mysql> create table DemoTable621 (UserName varchar(100), UserEmailId varchar(100), UserLastPost datetime); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable621 values('John', 'John@gmail.com', '2019-04-10 11:01:10'); Query OK, 1 row affected (0.47 sec) mysql> insert into DemoTable621 values('John', 'John@gmail.com', '2019-07-14 13:07:10'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable621;This will produce the following output −+----------+----------------+---------------------+ | UserName | UserEmailId | UserLastPost | +----------+----------------+---------------------+ | John | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
403 Views
For this, you can use INFORMATION_SCHEMA. Following is the syntax −select my_schema.SCHEMA_NAME, group_concat(tbl.TABLE_NAME) from information_schema.SCHEMATA my_schema left join information_schema.TABLES tbl on my_schema.SCHEMA_NAME=tbl.TABLE_SCHEMA group by my_schema.SCHEMA_NAME;Let us implement the above syntax in order to show all databases in MySQL and for each database −mysql> select my_schema.SCHEMA_NAME, group_concat(tbl.TABLE_NAME) from information_schema.SCHEMATA my_schema left join information_schema.TABLES tbl on my_schema.SCHEMA_NAME=tbl.TABLE_SCHEMA group by my_schema.SCHEMA_NAME;This will produce the following output −+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | SCHEMA_NAME | group_concat(tbl.TABLE_NAME) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
4K+ Views
Let’s say we installed MySQL version is 8.0 on our Windows OS. The bin directory is present at the following location −C:\Program Files\MySQL\MySQL Server 8.0\binLet us check the location. The screenshot is as follows −These are the drives −Go to C: drive and click Program Files −Now, click “MySQL” and open the folder −After that, click the current MySQL version folder. For us, it is MySQL Server 8.0 −Inside the folder, you can easily locate the bin folder as shown in the following screenshot −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
347 Views
For this, you can use INSERT INTO….SELECT statement. Let us first create a table −mysql> create table DemoTabe1 (Marks int); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTabe1 values(68); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTabe1 values(89); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTabe1 values(99); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTabe1 values(39); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTabe1 values(49); Query OK, 1 row affected (0.12 sec)Display all records from the table ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
7K+ Views
Let us first create a table −mysql> create table DemoTable719 (FirstNumber int, SecondNumber int); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable719 values(20, 10); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable719 values(500, 50); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable719 values(400, 20); Query OK, 1 row affected (0.11 sec)Display all records from the table using select statement −mysql> select *from DemoTable719;This will produce the following output −+-------------+--------------+ | FirstNumber | SecondNumber | +-------------+--------------+ | 20 | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
75 Views
For this, you can use a subquery. Let us first create a table −mysql> create table DemoTable618 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFirstName varchar(100) ); Query OK, 0 rows affected (1.45 sec)Insert some records in the table using insert command −mysql> insert into DemoTable618(StudentFirstName) values('David'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable618(StudentFirstName) values('Chris'); Query OK, 1 row affected (0.44 sec) mysql> insert into DemoTable618(StudentFirstName) values('Robert'); Query OK, 1 row affected (0.54 sec) mysql> insert into DemoTable618(StudentFirstName) values('Sam'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable618(StudentFirstName) values('Mike'); Query OK, 1 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
367 Views
To skip rows, you can use OFFSET. Let us first create a table −mysql> create table DemoTable617(Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(100)); Query OK, 0 rows affected (1.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable617(FirstName) values('John'); Query OK, 1 row affected (0.39 sec) mysql> insert into DemoTable617(FirstName) values('Sam'); Query OK, 1 row affected (0.39 sec) mysql> insert into DemoTable617(FirstName) values('Carol'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable617(FirstName) values('Mike'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable617(FirstName) values('David'); Query OK, 1 row affected (0.17 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
165 Views
For this, you can use aggregate function SUM(). Let us first create a table:mysql> create table DemoTable616 (Price varchar(100)); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable616 values('€200.00'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable616 values('€300.00'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable616 values('€500.00'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable616;This will produce the following output −+-----------+ | Price | +-----------+ | €200.00 | | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
253 Views
Let us first create a table −mysql> create table DemoTable615 (EmployeeId varchar(100), EmployeeName varchar(100)); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable615 values('EMP-101', 'Adam'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable615 values('EMP-1001', 'David'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable615 values('EMP-1002', 'Chris'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable615 values('EMP-1003', 'Robert'); Query OK, 1 row affected (0.21 sec)Display all records from the table using select statement −mysql> select *from DemoTable615;This will produce the following output −+------------+--------------+ | ... Read More