简体   繁体   中英

SQL Query Report Writing

I provided the ERD showing all the Tables and their info. How would I go about writing an SQL query for this report? Let me know if any other details are needed or if the ERD is sufficient.

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. better restructure it thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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