SQL:select/distinct/where/and/or/asc/desc/insert into/update

  • SELECT语句
    select city,name from Customers;

  • DISTINCT语句
    select distinct city from Customers;

  • WHERE语句
    select * from customers where city='Berlin';

  • AND & OR语句
    SELECT * FROM CUSTOMERS WHERE CITY='Berlin' AND (CUSTOMERID=1 OR CUSTOMERID=2);

  • ASC & DESC语句
    SELECT * FROM CUSTOMERS ORDER BY CITY DESC;

  • ORDER BY语句
    SELECT * FROM CUSTOMERS ORDER BY CITY DESC;

  • INSERT INTO语句
    insert into……values……
    INSERT INTO CUSTOMERS('CUSTOMERNAME','ADDRESS','CITY') VALUES('A','6','C');

  • UPDATE语句
    update……set……where
    UPDATE CUSTOMERS SET CITY='Berlin' WHERE CUSTOMERID=2;

你可能感兴趣的:(SQL:select/distinct/where/and/or/asc/desc/insert into/update)