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人点赞   数据库

 

 
上一篇:6-3 教师、学生排序


下一篇:【SQL语句】学习笔记