Select rows for a specific date using TIMESTAMP datatype

后端 未结 3 437
温柔的废话
温柔的废话 2021-01-27 09:51

I have the tables below in my database:

Student    (Stud_no: string, Stud_name: string)
Membership (Mem_no: string, Stud_no: string)
Book       (book_no: string,         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-27 10:19

    Note that we stopped writing queries this way ca. 1992. Come. Join us.

    FWIW, I find this easier to read...

    SELECT s.stud_name
         , b.book_name
         , b.author
         , r.iss_date
      FROM student s
      JOIN membership m
        ON m.stud_no = s.stud_no 
      JOIN iss_rec r 
        ON r.Mem_no = m.Mem_no 
      JOIN book b
        ON b.book_no = r.book_no
     WHERE r.iss_date BETWEEN '2019-08-06 00:00:00' AND '2019-08-06 23:59:59';
    

提交回复
热议问题