- 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)
135 Views
Any identifiers like tablename, stored procedure, viewname or column etc. may be quoted or unquoted. When an identifier is a reserved keyword then you must quote it, else an error would occur.Let us first create a table. Here, we have taken field names as reserved keywords −mysql> create table `INT` (`select` int, `varchar` varchar(100)); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into `INT` values(1, 'MySQL'); Query OK, 1 row affected (0.14 sec) mysql> insert into `INT` values(2, 'MongoDB'); Query OK, 1 row affected (0.34 sec) mysql> insert into `INT` values(3, ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
102 Views
For this, let us create a table, insert some values and use ORDER BY CASE. Let us first create a table −mysql> create table DemoTable602 (GameName text); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable602 values('Candy cash game'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable602 values('Pubg'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable602 values('cash Candy game'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable602 values('subway'); 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)
80 Views
Let us first create a table −mysql> create table DemoTable664 (CityName varchar(100)); Query OK, 0 rows affected (0.89 sec)Insert some records in the table using insert command −mysql> insert into DemoTable664 values('Springfield'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable664 values('Austin'); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable664 values('Franklin'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable664 values('OAKLAND'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable664 values('Anchorage'); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select *from DemoTable664;This will ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
693 Views
In ENUM data type, if you do not declare NOT NULL then it gives the default value NULL. However, if you declare NOT NULL then it gives the first value from the ENUM.CASE 1 −When the ENUM gives NULL value. Let us first create a table:mysql> create table DemoTable1(isMarried ENUM('YES', 'NO')); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output −+-----------+ | isMarried | +-----------+ ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
For this, use SUBSTRING_INDEX() and REPLACE(). Let us first create a table −mysql> create table DemoTable (Name varchar(100)); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command. Here, we have inserted last name and first names −mysql> insert into DemoTable values('Chris | Bob Brown'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Carol | Robert Taylor'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values('Sam | David Miller'); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
321 Views
To combine multiple advanced MySQL select queries, use UNION. Let us first create a table −mysql> create table DemoTable1 (Value1 int, Value2 int); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 29); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1 values(100, 190); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1 values(40, 101); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output −+--------+--------+ | Value1 | Value2 | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
207 Views
The INITCAP() method display the first character in every word in uppercase and rest in lowercase.To implement the opposite functionality, you need to create your own function in MySQL. Here’s the function −mysql> delimiter // mysql> create function convertFirstLetterToLowerAndRemainingToCapital(value varchar(250)) returns varchar(250) deterministic begin declare valueLength int; declare l int; set valueLength = char_length(value); set value = upper(value); set l = 0; while (l < valueLength ) do if (mid(value, l ,1) = ' ' or l = 0) then if (l < valueLength ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
79 Views
The CHANGE command in MySQL is used to rename column name. Let us first create a table −mysql> create table DemoTable796 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(100), StudentAge int ); Query OK, 0 rows affected (0.56 sec)Let us check the description of table −mysql> desc DemoTable796;This will produce the following output −+------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | Name ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
203 Views
Let us first create a table −mysql> create table DemoTable (CountryName varchar(100)); Query OK, 0 rows affected (1.01 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('US'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('AUS'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('UK'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+-------------+ | CountryName | +-------------+ | US | | AUS | | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
In order to enable innoDB in MySQ, you need to work around my.ini file. However, in MySQL version 8, the default storage engine is innoDB. Check the same from my.ini file −You can even set this at the time of table creation −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFirstName varchar(100), StudentLastName varchar(100), StudentAge int ) ENGINE=InnoDB; Query OK, 0 rows affected (1.66 sec)Let us now run a query to check the engine type of specific table −mysql> select table_name, engine from information_schema.tables where table_name="DemoTable";This will produce the following ... Read More