![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
870 Views
You need to use substring_index() function from MySQL to select text.The syntax is as followsSELECT substring_index(yourColumnName, '/', -1) AS anyAliasName FROM yourTableName;To understand the above concept, let us create a table. The query to create a table is as followsmysql> create table selectTextAfterLastSlashDemo - > ( - > UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > UserPathDirectory varchar(200) - > ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into selectTextAfterLastSlashDemo(UserPathDirectory) values('C:/MyFolder1/MyEntityFramework'); Query OK, 1 ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
The best way to change the date format in MySQL SELECT is as followsSELECT DATE_FORMAT(yourColumnName, "%d/%m/%Y %H:%i") AS anyAliasName FROM yourTableName WHERE yourCondition;To understand the above concept, let us create a table. The query to create a table is as followsmysql> create table bestDateFormatDemo - > ( - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > ArrivalDateTime datetime - > ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into bestDateFormatDemo(ArrivalDateTime) values(now()); Query OK, ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
83 Views
Yes, you can get expanded out in MySQL using the /G, instead of semicolon(;). The syntax is as followsSELECT *FROM yourTableName\GLet us first create a table as an examplemysql> create table expandedOutputDemo - > ( - > EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > EmployeeName varchar(20), - > EmployeeAge int - > ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into expandedOutputDemo(EmployeeName, EmployeeAge) values('Larry', 27); Query OK, 1 row affected (0.16 sec) mysql> insert into expandedOutputDemo(EmployeeName, EmployeeAge) values('Mike', 29); Query ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
147 Views
Get the create and update tables exact date using the create_time or update_time in MySQL.At first, use the SHOW command. The syntax is as followsSHOW TABLE STATUS;We are considering our database ‘test3’, which is already having some tablesmysql> use test3; Database changedNow use the following query to display all the tables in the database test3mysql> show tables;The following is the output+-------------------------+ | Tables_in_test3 | +-------------------------+ | add6hour | | deletedemo | | differentdatetime | | fieldlessthan5chars | | ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
504 Views
The syntax is as follows to rename Root @localhostUPDATE MySQL.user SET user = ‘yourNewRootName’ WHERE user = 'root';To understand the above concept, let us check all the user names and host. The query is as followsmysql> select user, host from MySQL.user;The following is the output+------------------+-----------+ | user | host | +------------------+-----------+ | Bob | % | | Manish | % | | User2 | % ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
106 Views
You can use two approaches to know the version of MySQL. In the first approach, you can use version() to know the MySQL Server version. The first approach is as followsSELECT VERSION();In the second approach, you can use SHOW VARIABLES command to know the MySQL version. The second approach is as followsSHOW VARIABLES WHERE Variable_name = 'version';Let us learn about both the syntaxes one by one.Using version()mysql> select version();The following is te output displaying the current version of the MySQL you are using+-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)The ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
6K+ Views
You can use UNION to get the previous and next record in MySQL.The syntax is as follows(select *from yourTableName WHERE yourIdColumnName > yourValue ORDER BY yourIdColumnName ASC LIMIT 1) UNION (select *from yourTableName WHERE yourIdColumnName < yourValue ORDER BY yourIdColumnName DESC LIMIT 1);To understand the concept, let us create a table. The query to create a table is as followsmysql> create table previousAndNextRecordDemo - > ( - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > Name varchar(30) - > ); Query OK, 0 rows affected (1.04 ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
Yes, it is possible to calculate a correlation in a query. To understand the correlation in a query, you need to first create a table. The query to create a table is as followsmysql> create table correlationDemo - > ( - > value float not null, - > value2 float not null - > ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table with the help of insert command. The query is as follows to insert records in the tablemysql> insert into correlationDemo values(1, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
434 Views
Let us first create a table. The query to create a table is as followsmysql> create table selectAllDemo - > ( - > Name varchar(100), - > Age int - > ); Query OK, 0 rows affected (1.90 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into selectAllDemo values('John', 25); Query OK, 1 row affected (0.99 sec) mysql> insert into selectAllDemo values('Carol', 26); Query OK, 1 row affected (0.42 sec) mysql> insert into selectAllDemo values('Bob', 30); Query OK, 1 row affected (1.57 ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
5K+ Views
You can use CASE statement to count two different columns in a single query. To understand the concept, let us first create a table. The query to create a table is as follows.mysql> create table CountDifferentDemo - > ( - > ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > ProductName varchar(20), - > ProductColor varchar(20), - > ProductDescription varchar(20) - > ); Query OK, 0 rows affected (1.06 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into CountDifferentDemo(ProductName, ProductColor, ProductDescription) values('Product-1', 'Red', 'Used'); Query OK, 1 row ... Read More