- 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)
49 Views
For this, you can use NOT LIKE operator. Let us first create a table −mysql> create table DemoTable -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentAdmissionYear varchar(20) -> ); Query OK, 0 rows affected (1.22 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName, StudentAdmissionYear) values('Chris', '2017'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentName, StudentAdmissionYear) values('David', '2015'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentName, StudentAdmissionYear) values('Bob', '2019'); Query OK, 1 row affected (0.18 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
455 Views
Let us first create a table −mysql> create table DemoTable -> -> ( -> StudentName varchar(20), -> StudentSubject varchar(20) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John', 'MySQL'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Adam', 'MySQL'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('John', 'Java'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable values('Carol', 'Java'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('John', 'MongoDB'); Query ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
84 Views
For this, use LEFT in MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> Title text -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Java database connectivity to MySQL database'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Python with django framework'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('C with data structure and algorithm'); Query OK, 1 row affected (0.33 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)
94 Views
Use the MySQL LIKE operator to match even when punctuation is present. Let us first create a table−mysql> create table DemoTable -> ( -> Comments varchar(20) -> ); Query OK, 0 rows affected (1.10 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Good, Morning'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Nice'); Query OK, 1 row affected (0.51 sec) mysql> insert into DemoTable values('good, bye!'); 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 following ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
40 Views
You need to use intvalue=1. The statement intvalue=’1’ is internally converted to cast(‘1’ as int) by MySQL.Let us first create a table −mysql> create table DemoTable1566 -> ( -> intvalue int -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1566 values(1); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1566 values(55); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1566 values(75); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable1566 values(90); Query OK, 1 row affected (0.19 sec)Display all ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
For this, you can use STR_TO_DATE(). Let us first create a table −mysql> create table DemoTable1565 -> ( -> ArrivalDatetime varchar(40) -> ); Query OK, 0 rows affected (0.82 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1565 values('10/01/2019 21:29:35'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable1565 values('10/13/2019 4:56:00'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1565 values('10/13/2018 12:40:46'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1565 values('10/13/2019 21:30:00'); Query OK, 1 row affected (0.58 sec)Display all records from the table using select ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
For this, you can use the CASE statement. Let us first create a table−mysql> create table DemoTable -> ( -> Name varchar(20), -> Marks1 int, -> Marks2 int -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command−mysql> insert into DemoTable values('Chris', 45, null); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('David', null, 78); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('Bob', 67, 98); Query OK, 1 row affected (0.14 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)
72 Views
For this, use MySQL FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable1563 -> ( -> StudentId int, -> StudentName varchar(20) -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1563 values(1001, 'Chris'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1563 values(1010, 'Bob'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1563 values(1005, 'Chris'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1563 values(1015, 'David'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1563 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
663 Views
To sort from max to min value, use ORDER BY length(). Let us first create a table −mysql> create table DemoTable -> ( -> Price varchar(20) -> ); Query OK, 0 rows affected (0.92 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('80'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('800'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('108'); Query OK, 1 row affected (0.50 sec) mysql> insert into DemoTable values('765'); Query OK, 1 row affected (0.14 sec)Display all records from the table using ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
250 Views
Do not prefix table name with field name like user_name. Instead, use user or username.If you prefix table name, then there may be a chance of ambiguity, so avoid prefixing table name.Let us first create a table −mysql> create table user -> ( -> username varchar(20), -> password varchar(20) -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into user values('John', 'J_635'); Query OK, 1 row affected (0.34 sec) mysql> insert into user values('Carol', 'Carol2212'); Query OK, 1 row affected (0.16 sec) mysql> insert into user ... Read More