设为首页 加入收藏

TOP

数据库面试题(九)
2014-11-24 03:04:52 来源: 作者: 【 】 浏览:27
Tags:数据库 试题
ol….)
  删除索引:drop index idxname
  注:索引是不可更改的,想更改必须删除重新建。
32.说明:
  创建视图:create view viewname as select statement
  删除视图:drop view
viewname
33.说明:几个简单的基本的sql语句
  选择:select * from table1 where范围
  插入:insert into
table1(field1,field2) values(value1,value2)
  删除:delete from table1 where
范围
  更新:update table1 set field1=value1 where范围
  查找:select * from table1
where field1 like’%value1%’ ---like的语法很精妙,查资料!
  排序:select * from table1
order by field1,field2 [desc]
  总数:select count * as totalcount from
table1
  求和:select sum(field1) as sumvalue from table1
  平均:select
avg(field1) as avgvalue from table1
  最大:select max(field1) as maxvalue from
table1
  最小:select min(field1) as minvalue from table1
31、简单查询
select name from bbc where population>=200000000; --查询显示出人口不小于2亿的国家名字
select name ,(gdp/population)'人均GDP' from bbc where population>=200000000; --人口不小于200000000国家名称及人均gdp
select name , round((populatio/1000000))'人口数(百万)' from bbc where name in(south asia);
select name,popultion from bbc where name ='France', 'Germany', 'Italy'; --查询出france,germany,italy三国的人口数
select name from bbc where name like '%united%'查询出国家名称包括united字符的的所有国家名称;
表获得诺贝尔奖
select yr,subject winner from nobel where yr = 1950; --显示1950年获得诺贝尔奖的人.的所有信息
select winner from nobel where yr =1962; --1962文学奖获得者
select yr,subject from nodel where winner ='albert einstin'; --显示'Albert Einstein'获奖的年份和奖项.
select winner from nodel where yr>=2000 and subject = '和平奖';--2000年以来(包含2000年)和平奖的得主.
select * from nodel where yr between 1980 and 1989 and subject = '文学奖'; --1980到 1989间文学奖获得者的所有信息
select *from nodel where winner=('Theodore Roosevelt', 'Woodrow Wilson', 'Jed Bartlet', 'Jimmy Carter');
select winner from nodel where winner like 'john%'
首页 上一页 6 7 8 9 下一页 尾页 9/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇使用Mongodb的搜索拼音自动补全方.. 下一篇数据库死锁的解决办法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·哈希表 - 菜鸟教程 (2025-12-24 20:18:55)
·MySQL存储引擎InnoDB (2025-12-24 20:18:53)
·索引堆及其优化 - 菜 (2025-12-24 20:18:50)
·Shell 中各种括号的 (2025-12-24 19:50:39)
·Shell 变量 - 菜鸟教 (2025-12-24 19:50:37)