插入完整的行
insert into customers
values(NULL,
'Pep E .LaPew',
'100 Main Street',
'Los Angeles',
'CA',
'90046',
'USA',
NULL,
NULL);
insert into customers(cust_name,
cust_contact,
cust_email,
cust_address,
cust_city,
cust_state,
cust_zip,
cust_country)
values('Pep E .LaPew',
NULL,
NULL,
'100 Main Street',
'Los Angeles',
'CA',
'90046',
'USA');
插入多个行
insert into customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_contact,
cust_zip,
cust_country)
values('Pep E .LaPew',
'100 Main Street',
'Los Angeles',
'CA',
'90046',
'USA');
insert into customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_contact,
cust_zip,
cust_country)
values('M. Martian',
'42 Galaxy Way',
'New York',
'NY',
'11213',
'USA');
或者
insert into customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_contact,
cust_zip,
cust_country)
values('Pep E .LaPew',
'100 Main Street',
'Los Angeles',
'CA',
'90046',
'USA'),
('M. Martian',
'42 Galaxy Way',
'New York',
'NY',
'11213',
'USA');
插入检索出来的数据
insert into customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_contact,
cust_zip,
cust_country)
select cust_name,
cust_address,
cust_city,
cust_state,
cust_contact,
cust_zip,
cust_country
from custnew;
更新数据
更新单个列
update customers
set cust_email = 'elmer@fudd.com'
where cust_id = 10005;
更新多个列
update customers
set cust_name = 'The Fudds',
cust_email = 'elmer@fudd.com'
where cust_id = 10005;
删除某个列的值
update customers
set cust_email = null
where cust_id = 10005;
删除数据
delete from customers
where cust_id = 10006;