Day 3 reading

Day 3 reading

by Zhifei Xu -
Number of replies: 0

In today’s video, I learn something about what is and how to use SQL. In the first part the professor Jennifer. It talks about the introduction of SQL; SQL is a language supported by all major commercial database systems. And it has two parts of language ‘DDL’ and ‘DML’. I think when we query the database, all the operations are DML. According to the website SQL tutorials, I have finished the part of select. You know the SQL operator online if you only watch it, it is very easy to understand. However, I'm not quite sure I've got it all because it doesn't have enough tests for us to write a select program. However, through today's video, I have further understood some more detailed usages of the selection procedure. In this video, it not only teaches you how to select but also links the relational algebra before, so that I can know more clearly how to write the procedure of select than before. For instance:  

  If you want to get the sID and GPA of a student whose GPA is over 3.4

        Select   sID, GPA.  (this is return)

        From student.         (relation)

        Where  GPA>3.4.   (combine filter)

     If you want to get the names and GPAs of students who applied 

       Select sName, major

       From student*apply

      Where student.sID=apply.sID

In this result, it will repeat the name of the match twice, because the id of some students in the table will appear again in the table of apply. So, if you want to solve this problem you need to add another operator, the ‘distinct’ is duplicate the value eliminated. This is something I can not learn from online and it like it.

    

 Select distinct  sName, major

  From student*apply

  Where student.sID=apply.sID