绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
sql base
2022-05-07 17:37:58

SELECT

    SELECT * FROM 表名称
        SELECT * FROM Persons
    SELECT 列名1,列名2 FROM 表名称
        SELECT LastName,FirstName FROM Persons
    SELECT DISTINCT 列名称 FROM 表名称(返回不同的值)
        SELECT DISTINCT Company FROM Orders 
    SELECT 列名称 FROM 表名称 WHERE 列 运算符 值
        SELECT * FROM Persons WHERE City='Beijing'
        SELECT * FROM Persons WHERE Year>1965
        SELECT * FROM Persons WHERE FirstName='Thomas' AND LastName='Carter'
        SELECT * FROM Persons WHERE firstname='Thomas' OR lastname='Carter'
        SELECT * FROM Persons WHERE (FirstName='Thomas' OR FirstName='William') AND LastName='Carter'
        SELECT Company, OrderNumber FROM Orders ORDER BY Company
        SELECT Company, OrderNumber FROM Orders ORDER BY Company, OrderNumber
        SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC(默认升序)
        SELECT Company, OrderNumber FROM Orders ORDER BY Company DESC, OrderNumber ASC

INSERT   

INSERT INTO 表名称 VALUES (值1, 值2,....)
        INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
    INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....) (指定列中插入数据)
        INSERT INTO Persons (LastName, Address) VALUES ('Wilson', 'Champs-Elysees')

UPDATE   

UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
        UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson'
        UPDATE Person SET Address = 'Zhongshan 23', City = 'Nanjing' WHERE LastName = 'Wilson'

DELETE

DELETE FROM 表名称 WHERE 列名称 = 值
        DELETE FROM Person WHERE LastName = 'Wilson' 
    DELETE FROM 表名称(删除所有行。表的结构、属性和索引都是完整的)
        DELETE FROM table_name
        DELETE * FROM table_name

分享好友

分享这个小栈给你的朋友们,一起进步吧。

SQLBase
创建时间:2022-03-30 11:00:13
SQLBase
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • 飘絮絮絮丶
    专家
戳我,来吐槽~