- 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
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
945 Views
For this, you can create a stored procedure. Let us first create a table.mysql> create table DemoTable -> ( -> Value int -> ); Query OK, 0 rows affected (0.55 sec)Following is the query to create a stored procedure to auto insert values to a table from range 10 to 20 −mysql> DELIMITER // mysql> CREATE PROCEDURE AutoInsertValuesToTable() -> BEGIN -> DECLARE startingRange INT DEFAULT 10; -> WHILE startingRange INSERT DemoTable(Value) VALUES (startingRange ); -> SET startingRange = startingRange + 1; -> ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
487 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Number int -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Number) values(10); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(Number) values(20); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(Number) values(30); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Number) values(40); Query OK, 1 row affected (0.14 sec) Display all records from ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
502 Views
Use i.e. not equal in MySQL to exclude a specific row from a table. Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> FirstName varchar(100) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1, 'John'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(2, 'Chris'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(3, 'Robert'); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable ... Read More
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
612 Views
For this, you can use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Subject varchar(100) -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Subject) values('MySQL'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Subject) values('MongoDB'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(Subject) values('MySQL'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(Subject) values('Java'); Query OK, 1 ... Read More
![Rama Giri](https://www.tutorialspoint.com/assets/profiles/13881/profile/60_68188-1512710896.jpg)
954 Views
For this, you can use concat() function from MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20), -> Subject varchar(100) -> ); Query OK, 0 rows affected (17.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Subject) values('John', 'MySQL'); Query OK, 1 row affected (1.19 sec) mysql> insert into DemoTable(Name, Subject) values('Chris', 'SQL Server'); Query OK, 1 row affected (0.88 sec) mysql> insert into DemoTable(Name, Subject) values('Robert', 'MongoDB'); Query OK, 1 row affected ... Read More
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
215 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('Carol'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Name) values('Chris'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(Name) values('David'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(Name) values('Bob'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Name) ... Read More
![Rama Giri](https://www.tutorialspoint.com/assets/profiles/13881/profile/60_68188-1512710896.jpg)
111 Views
If given a string containing a path to a file, the PHP basename() function will return the base name of the file. To get its equivalent in MySQL, you can use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable -> ( -> Location varchar(200) -> ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('C:\Web\Sum.java'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('E:\WebDevelopment\Image1.png'); Query OK, 1 row affected (0.42 sec)Display all records from the table using select statement ... Read More
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
123 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(NULL); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(NULL); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+-------+ | Name ... Read More
![Rama Giri](https://www.tutorialspoint.com/assets/profiles/13881/profile/60_68188-1512710896.jpg)
358 Views
Yes, we can do that using the CASE statement. Let us first create a table −mysql> create table DemoTable -> ( -> isMarried boolean -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(true); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(false); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(false); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(true); Query OK, 1 row affected (0.19 sec)Display all records from the table ... Read More
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
2K+ Views
To convert time to seconds, use the TIME_TO_SEC() method. Let us first create a table −mysql> create table DemoTable -> ( -> ArrivalTime time -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('04:10:00'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('05:20:50'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('06:40:10'); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+-------------+ | ArrivalTime | +-------------+ | 04:10:00 ... Read More