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;

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,452评论 0 10
  • Introduction of SQL:Organize data into one or more tables...
    彭Jennie阅读 1,020评论 1 2
  • 在互联网行业从事数据分析,要学一些必备的技能,比如SQL/HIVE。因此我将之前学习的SQL知识资源进行统一整理一...
    年少轻狂不能用来挥霍阅读 1,035评论 0 0
  • MYSQL 基础知识 1 MySQL数据库概要 2 简单MySQL环境 3 数据的存储和获取 4 MySQL基本操...
    Kingtester阅读 7,857评论 5 116
  • SQL 分为两个部分:数据操作语言 (DML) 和 数据定义语言 (DDL) 查询和更新指令构成了 SQL 的 D...
    张颉雨阅读 411评论 0 0