- 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)
129 Views
Let us first create a table −mysql> create table DemoTable ( FirstName varchar(100) ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
506 Views
To return only the first 15 characters from string values, use the MySQL SUBSTR() function.Let us first create a table −mysql> create table DemoTable ( Title varchar(100) ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Introduction to MySQL'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('Introduction to Java'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('C in Depth with data structure and algorithm'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
4K+ Views
To add percentage sign at the end, use CONCAT() function. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(100), StudentScore int ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName, StudentScore) values('John', 65); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(StudentName, StudentScore) values('Chris', 98); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable(StudentName, StudentScore) values('Robert', 91); Query OK, 1 row affected (0.09 sec)Display all records from the table using select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
795 Views
To add leading zeros, you can use LPAD(). Let us first create a table −mysql> create table DemoTable ( Code varchar(100) ); Query OK, 0 rows affected (0.87 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('JS'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('CB'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('DM'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('CT'); Query OK, 1 row affected (0.07 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
218 Views
For this, you can use the DATE() function. Let us first create a table −mysql> create table DemoTable ( Number int ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(20190108); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(20161231); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(20170411); Query OK, 1 row affected (0.09 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----------+ | Number | +----------+ | 20190108 | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
66 Views
Let us first create a table −mysql> create table DemoTable ( Number int ); Query OK, 0 rows affected (0.79 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(56); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(78); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(89); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(98); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(91); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable values(96); Query OK, 1 row affected ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
202 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(100) ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('John Smith'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Name) values('Carol Taylor'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(Name) values('John Doe'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Name) values('Chris Brown'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Name) values('John Brown'); Query OK, 1 row ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
195 Views
Let us first create a table −mysql> create table DemoTable ( Download varchar(100) ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('120 Gigabytes'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('190 Gigabytes'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('250 Gigabytes'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('1000 Gigabytes'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----------------+ ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
187 Views
To get a particular varchar ID from a list, you can use FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable ( Id varchar(255) ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('10, 100, 1000'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('101, 120, 2'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('3, 4, 5'); Query OK, 1 row affected (0.11 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
571 Views
For this, you can use IS NULL property. Let us first create a table −mysql> create table DemoTable ( ProductPrice int, ProductQuantity int, TotalAmount int ); Query OK, 0 rows affected (1.22 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ProductPrice, ProductQuantity) values(100, 2); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(ProductPrice, ProductQuantity) values(500, 4); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable(ProductPrice, ProductQuantity) values(1000, 10); Query OK, 1 row affected (0.21 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce ... Read More