2017-06-21 42 views
-3

我有一个研究问题,我难倒了我。任何建议将不胜感激!只有一些基本的例子会让我朝正确的方向发展。谢谢!基本查询学习项目 - 建议?

您收到2017年日历年期间输入数据库的学生测验信息列表请求。 (a)每个学生得分,(b)学生姓名,(c)测验的类别以及(d)将分数输入数据库时​​的SQL查询。

+1

您能分享您的表格结构吗? – Mureinik

+0

表格的名称和结构请包括列名 –

+0

这不是“家庭作业”的定义吗?没有任何尝试,没有问题来帮助或提问(除了实际的家庭作业)。 – Turophile

回答

0

如果你仍然需要建立表格并自己查询它们,它会是这样的。您可以阅读注释并查看每种语法的做法

--CREATING the tables for the student information 
    create table quizinfo (
       StudentId INT, 
       Name VARCHAR(500), 
       Score INT, 
       Class VARCHAR(500), 
       DateEntered smalldatetime, 
       Year INT 
      ) 

    --Inserting data to the table 
     Insert into quizinfo values ('1', 'Ken Lee', '95', 'Math', '2017-05- 
     20', ' 2017') 
     Insert into quizinfo values ('2', 'Maria Chen', '100', 'Math', '2017- 
     05-20', '2017') 
     Insert into quizinfo values ('3', 'Sophia Reyes', '100', 'Math', 
     '2017-05-20', '2015') 

    --Selecting the data from the table where the year is only for 2017. The 
    --WHERE year = 2017 makes sure that it only picks up rows for 2017 
    SELECT Name, Score, Class, DateEntered, Year FROM quizinfo 
    WHERE year = '2017'