SQL基础

作者: 天涯的尽头s风沙 | 来源:发表于2019-06-17 09:44 被阅读2次
  • 现在有一个学生表,一个课程成绩表,请问,怎么找出学生课程的最高分数,谈一谈思路

  • 现在,有一个组合索引(A,B,C),可以有哪几种查询方式?

考察点:sql语句
参考回答:

优: select * from test where a=10 and b>50

差: select * from test where b = 50

优: select * from test order by a

差: select * from test order by b

差: select * from test order by c

优: select * from test where a=10 order by a

优: select * from test where a=10 order by b

差: select * from test where a=10 order by c

优: select * from test where a>10 order by a

差: select * from test where a>10 order by b

差: select * from test where a>10 order by c

优: select * from test where a=10 and b=10 order by a

优: select * from test where a=10 and b=10 order by b

优: select * from test where a=10 and b=10 order by c

优: select * from test where a=10 and b=10 order by a

优: select * from test where a=10 and b>10 order by b

差: select * from test where a=10 and b>10 order by c

  • 写SQL:找出每个城市的最新一条记录。

考察点:sql语句
参考回答:

id 城市 人口 信息 创建时间
1 北京 100 info1 时间戳
2 北京 100 info2 时间戳
3 上海 100 info3 时间戳
4 上海 100 info4 时间戳

相关文章

  • sql

    sql-基础sql-基础查询-1sql-基础查询-2sql-更新 概览 数据库(Database,DB):将大量数...

  • SQL基础及元数据获取(数据类型,表的属性)

    1、SQL基础应用 ①.SQL的介绍SQL标准:SQL-92、SQL-99SQL_MODE:都是为了保证SQL语句...

  • MySql手动注入

    information_schema SQL基础 1.1 什么是sql? SQL(structured query...

  • MySQL

    数据类型 sql基础 数据库表 SQL SELECT 语句: SQL WHERE 子句: SQL AND & OR...

  • SQL语句

    SQL基础应用 SQL语句自动补全 SQL的介绍 SQL-92标准SQL-99标准 image SQL常用分类 表...

  • SQL高级运用

    -- =================================sql基础补充==============...

  • mysql的用法2

    -- =================================sql基础补充==============...

  • Oracle学习-day26:SQL语句

    一、SQL语言基础 1.什么是SQL语言? (1)SQL, Structured Query Language, ...

  • oracle 基础复习

    1. SQL 基础 https://mubu.com/doc/3ANPHhveeK 2. PL/SQL 基础 ht...

  • mysql手工注入

    SQL基础 1.1 什么是sql? SQL(structured query language),即结构化查询语言...

网友评论

    本文标题:SQL基础

    本文链接:https://www.haomeiwen.com/subject/omyofctx.html