Mysql common statements (2)

View database

show databases;

Create a database of students

create database student;

Create student table

create table student
(
id int auto_increment,
name varchar(30) not null,
primary key(id)
);

limit

select * from student limit 1; #Output a piece of information in the student table

offset

select * from student limit 1 offset 1; #Start from the second data to output a piece of information in the student table
select * from student limit 1 offset 2; #Start from the third data to output a piece of information in the student table
select * from student limit 2 offset 1; #Output 2 pieces of learning information from the second piece of data
select * from student limit 2 offset 2; #Start from the third piece of data to output 2 pieces of student information

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325504890&siteId=291194637