- 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)
434 Views
To round, use MySQL ROUND() function. Let us first create a table −mysql> create table DemoTable1865 ( Value1 int, Value2 int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1865 values(40, 60); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1865 values(100, 400); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1865 values(545, 896); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1865;This will produce the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
849 Views
Use @anyVariableName to assign the result of a query into a variable. Let us first create a table −mysql> create table DemoTable1864 ( Id int, FirstName varchar(20), LastName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1864 values(101, 'Chris', 'Brown'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1864 values(102, 'David', 'Miller'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1864 values(103, 'Adam', 'Smith'); Query OK, 1 row affected (0.00 sec) mysql> insert into ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
552 Views
To set default value for empty row, use the concept of COALESCE(). Let us first create a table −mysql> create table DemoTable1863 ( FirstName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1863 values('Chris'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1863 values(NULL); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1863 values('David'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1863 values(NULL); Query OK, 1 row affected (0.00 sec)Display all records from the table ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
149 Views
For this, use the concept of GREATEST(). Let us first create a table −mysql> create table DemoTable1862 ( Value1 int, Value2 int, Value3 int, Value4 int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1862 values(43, 34, 56, 42); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1862 values(NULL, 78, 65, NULL); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1862 values(110, NULL, 78, NULL); Query OK, 1 row affected (0.00 sec)Display all ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
350 Views
For this, you can use GROUP BY HAVING with subquery. Let us first create a table −mysql> create table DemoTable1861 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20), Marks int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1861(Name, Marks) values('John', 45); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1861(Name, Marks) values('Chris', 74); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1861(Name, Marks) values('David', 89); Query OK, 1 row affected (0.00 sec) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
420 Views
For this, you can use SELECT INTO. Let us first create a table −mysql> create table DemoTable1860 ( Amount int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1860 values(1590); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1860 values(410); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1860 values(3000); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −Mysql> select * from DemoTable1860; This will produce the following output −+--------+ | Amount ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
180 Views
Yes, use the ALTER command with RENAME. Let us first create a table −mysql> create table DemoTable1859 ( Id int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1859 values(101); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1859 values(102); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1859; This will produce the following output −+------+ | Id | +------+ | 101 | | 102 | +------+ 2 rows ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
506 Views
For this, use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable1858 ( ModelNumber varchar(50) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1858 values('Audi A4'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1858 values('Audi A6'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1858 values('Audi A4'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1858 values('Audi Q5'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1858 values('Audi R8'); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
798 Views
For this, you can use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable1857 ( Name varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1857 values('John-Smith'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1857 values('Brown-Chris'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1857 values('David-Carol-Miller'); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1857; This will produce the following output −+--------------------+ | Name ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
124 Views
To fix, use group_concat() with addition of 0 with column. Let us first create a table −mysql> create table DemoTable1856 ( Id int, Value bit(1) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1856 values(101, 1); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1856 values(102, 0); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1856 values(101, 0); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1856 values(102, 1); Query OK, 1 row affected (0.00 ... Read More