SQL语言

SQL(Struct Query Language)结构化查询语言是关系数据库管理系统的标准语言。Create,Select,Insert,Update,Delete,Drop table。

1、Select

select [column1, column2,etc] from tablename
[where condition];

例如:

select select firstname, lastname, city
from employee
where firstname LIKE E%';

select * from employee
where firstname = 'Ma';

2、Create

create table tablename
(column1 data type,
column2 data type,
column3 data type);

create table tablename
(column1 data type [constraint],
column2 data type [constraint],
column3 data type [constraint]);

例如:
create table employee
(firstname varchar(15),
lastname varchar(20),
age number(3),
address varchar(30),
city varchar(20));

3、Insert

insert into tablename
(first_column,...last_column)
values (first_value,...last_value);

例如:
insert into employee
(firstname, lastname, age, address, city)
values ('Li', 'Ming', '45', 'No.77 Changan Road', 'Beijing');

4、Update

update tablename
set columnname = newvalue [, nextcolumn = newvalue2...]
where columnname OPERATOR value [and or column OPERATOR value];

例如:
update employee
set age = age+1
where first_name='Mary'and last_name='Williams';

5、Delete

delete from tablename
where columnname OPERATOR value [and or column OPERATOR value];

例如:
delete from employee
where lastname = May;

6、Drop table

drop table tablename;

例如:
drop table employee;


SELECT…FROM的详细用法必须

DISTINCT
SUM
AVG
COUNT
GROUP BY
HAVING
ALIAS

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值