一些关于数据库的最基本的命令 急

来源:百度知道 编辑:UC知道 时间:2024/05/24 18:04:52
1、在SQL中用( )查找记录,用( )插入记录,用( )更新记录,用( )删除记录
2、设有数据库表company,结构如下:
Name null type
---------------------------------------------------------------------------
Id not null char(10)
Name null char(10)
Tel null char(10)
Num null num
用SQL语句回答下列问题
1) 查找name中包括“北泰”的所有记录,并按name排序
2) 插入一条记录,id=‘100’name=‘hello’tel=‘12345678’num=169
3) 更新记录,将id=‘100’的记录中name改为‘hell.company’
4) 删除记录,条件为id=‘100’并且name=‘hell.company’
5) 删除记录,条件为id=‘123’或则name=‘beitai’
6) 将每条记录中num增加50
7) 删除表company

都是简单的不能再简单的命令了吧
希望会的人能认真解答 谢谢

1:用select查找记录,用insert插入记录,用update更新记录,用delete删除记录

2:select * from company where name='北泰' group by name desc
insert company values('100','hello','12345678','169')
update company set name='hell.company' where id='100'
delete from company where id='100' and name='hell.company'
delete from company where id='123' or name='beitai'
update company set num=num+50
drop table company

字段为 char 时 在sql中应用 ' ' 引起

排序 用 order by 默认升序排列 降序排列为 order by desc
分组 用 group by

1. select * from company where name like '%北泰%' order by name

2. insert into company (id,name,tel,num) values('100','hello','12345678',169 )

3. update company set name='hell.company' where id='100'

4. delete company where id='100' and name='hell.co