2021-05-23 SQL 练习

--Use the NOT keyword to select all records where City is NOT "Berlin"

SELECT * FROM Customers

WHERE NOT City = ‘Berlin‘;

 

--通配符 _

--Select all records where the first letter of the City is an "a" or a "c" or an "s".

SELECT * FROM Customers

WHERE City LIKE '[acs]%';

 

--Select all records where the first letter of the City is NOT an "a" or a "c" or an "f".

SELECT * FROM Customers

WHERE City LIKE '[!acf]%';

 

--Use the TRUNCATE statement to delete all data inside a table. 只删除数据,不删除表本身

TRUNCATE TABLE Persons;

 

--Add a column of type DATE called Birthday.

ALTER TABLE Persons

ADD Birthday DATE;

 

--Delete the column Birthday from the Persons table.

ALTER TABLE Persons

DROP COLUMN Birthday;

 
 
0人点赞
 
数据库

 

 
posted @ 2021-05-24 19:49  胡糊糊同学  阅读(66)  评论(0)    收藏  举报