SQL basic statement
create table person(
id int(10),
lastname varchar(24),
firstname varchar(24),
address varchar(24),
city varchar(24),
primary key(id)
)
insert into person values(1, 'Gates', 'Bill', 'Xuanwumen', 'Beijing');
insert into person values(2, 'Dell', 'Smith', 'Heping', 'Tianjin');
insert into person values(3, 'Tom', 'David', 'Haidian', 'Beijing');
insert into person(id, lastname, firstname) values(4, 'Will', 'John');
select * from person;
select lastname, firstname from peerson;
insert into person values(5, 'Han', 'David', 'Zhongyuan', 'Zhengzhou');
select firstname from person;
select distinct firstname from person;
select * from person where city = 'Beijing';
select * from person where address = 'Haidian' and city = 'Beijing';
select * from person where address = 'Heping' or firstname = 'David';
select * from person order by lastname asc;
select * from person order by firstname desc;
select * from person order by city asc, address desc;
In the above result, there are two equal cities (Beijing). Only this time, when there is the same value in the first column, the second column is sorted in descending order. This is also the case if some values in the first column are nulls.
update person set lastname = 'Bob' where id = 3;
delete from person where id = 4;
delete from person
delete * from person
# 效果一样,但是带*的执行比不带*的快,可以试一下