- 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)
845 Views
For this, use ORDER BY MAX(). Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, 'John'); Query OK, 1 row affected (0.51 sec) mysql> insert into DemoTable values(10, 'John'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(20, 'Sam'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(20, 'Sam'); Query OK, 1 row affected (0.11 sec) ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
572 Views
For this, you can use ORDER BY clause. Let us first create a table −mysql> create table DemoTable -> ( -> Num1 int, -> Num2 int -> ); Query OK, 0 rows affected (0.61 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(60, 249); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(59, 250); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will produce the following output −+------+------+ | Num1 | Num2 | +------+------+ | 60 | 249 ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
340 Views
Let us first create a table −mysql> create table DemoTable -> ( -> StudentId varchar(100) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('STU-090'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('STU-123'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('STU-678'); Query OK, 1 row affected (0.29 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will produce the following output −+-----------+ | StudentId | +-----------+ | STU-090 | ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
1K+ Views
Use the SUBSTR() method to get the substring of a column.Let us first create a table −mysql> create table DemoTable -> ( -> Title text -> ); Query OK, 0 rows affected (0.74 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('This is a MySQL Database'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('Java is an Object Oriented Programming Language'); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select *from DemoTable ;OutputThis will produce the following output −+-------------------------------------------------+ | Title ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
373 Views
Let us first create a table. One of the column is a timestamp −mysql> create table DemoTable -> ( -> CustomerName varchar(100), -> CustomerShippingDate timestamp -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', '2019-01-21'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('David', '2019-03-01'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values('Robert', '2019-06-04'); Query OK, 1 row affected (0.25 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
395 Views
For random, use RAND() method. And for limit on rows, use the LIMIT() method.Let us first create a table −mysql> create table DemoTable -> ( -> ShippingDate datetime -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-01'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2019-01-03'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('2019-01-05'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2019-01-07'); Query OK, 1 row affected (0.11 sec) ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
212 Views
For this, use the LEFT() method, which returns a specified number of characters from the left of the string.Let us first create a table −mysql> create table DemoTable -> ( -> FirstName varchar(100) -> ); Query OK, 0 rows affected (0.96 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Sam'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
105 Views
Let us first create a table −mysql> create table DemoTable -> ( -> AdmissionDate datetime -> ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-10 10:45:10'); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values('2019-02-12 20:50:00'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('2019-02-12 16:10:19'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will produce the following output −+---------------------+ | AdmissionDate ... Read More
![Kumar Varma](https://www.tutorialspoint.com/assets/profiles/13883/profile/60_73481-1512711460.jpg)
834 Views
Let us first create a table −mysql> create table DemoTable -> ( -> FirstName varchar(100) -> ); Query OK, 0 rows affected (0.41 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Adam^^^'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('^^^^^^^^Carol'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Robert^^^^^^'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will produce the following output −+---------------+ | FirstName | +---------------+ | Adam^^^ ... Read More
![Rama Giri](https://www.tutorialspoint.com/assets/profiles/13881/profile/60_68188-1512710896.jpg)
1K+ Views
Let us first create a table −mysql> create table DemoTable -> ( -> Value1 int, -> Value2 int -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, 10); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values(20, 30); Query OK, 1 row affected (0.24 sec)Display all records from the table using select statement −mysql> select *from DemoTable;OutputThis will produce the following output −+--------+--------+ | Value1 | Value2 | +--------+--------+ | 10 | 10 | ... Read More