DROP DATABASE DatabaseName;
例子:DROP DATABASE test;
USE DatabaseName;
例子:USE test;
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
); varchar与nvarchar要在类型后加长度(长度)
例子:create table gg (
id int ,
name varchar(3),
age varchar(4)
)
DROP TABLE table_name;
例子:DROP TABLE website;
INSERT INTO table_name (column1, column2, column3,...columnN)
VALUES (value1, value2, value3,...valueN);
例子:insert into gg (id,name,age) values (1,'dd','男');
SELECT column1, column2, columnN
FROM table_name
WHERE conditions;
例子:SELECT id, name, url FROM website;
SELECT column1, column2, columnN
FROM table_name
WHERE [condition1] OR [condition2]...OR [conditionN]
例子:SELECT id, name, url, uv
FROM website
WHERE uv<500 OR age>20;
UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];
例子:UPDATE website
SET name = 'stack-overflow'
WHERE id = 6;
DELETE FROM table_name
WHERE [condition];
例子:DELETE FROM website
WHERE id = 6;
SELECT FROM table_name WHERE column LIKE 'pattern'
例子:SELECT * FROM website WHERE uv LIKE '59%';