简体   繁体   English

SQL查询报告编写

[英]SQL Query Report Writing

I provided the ERD showing all the Tables and their info. 我提供了显示所有表格及其信息的ERD。 How would I go about writing an SQL query for this report? 我将如何为该报告编写SQL查询? Let me know if any other details are needed or if the ERD is sufficient. 让我知道是否需要其他详细信息或ERD是否足够。

Thanks! 谢谢!

SELECT date(s.showtime) as date
    , s.showtime
    , c.channelnumber
    , p.progname
    , p.proglength 
    , su.suppliername
FROM program as p left join schedule as s on p.progid = s.programid 
left join channel as c on s.channelid = c.channelid 
left join supplier as su on p.supplierid = su.supplierid 

your schedule table has many pk and your structure is not according to normalized form. 您的进度表中有许多pk,并且您的结构不符合规范化格式。 better restructure it thanks 更好地重组它,谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM