Your videos are helping me a lot in understanding SQL and Database design! I hope you could do something similar to this (creating SQL code from a DB design) but with Join tables.
Hey, I'm working on a hospital appointment system right now and one of the issues is fixing an appointment between a patient and doctor for a given date and time. Suppose each consultation appointment is in 30 minutes block, do you think it's a good idea to have a separate table each for dates and times?
Good question! I don't see the need to have a separate table for "all possible dates and times". I assume it could be done by showing input fields on the screen for the user to select from. They could select a preferred date, and a time, where the time is a 30-minute block (e.g. 9:00 9:30, 10:00). You could then save this selected value in the table that stores the appointment information. Hope that helps!
@@DatabaseStar Thank you for replying! I was thinking from the input field's perspective as well where users can immediately see the available timings. By designing a separate table for, I can retrieve this list with a simple query i.e. select * from timeslots where status != 'booked'. A stored procedure updates the status of the timeslot if it was booked or made available again. But this will take up a lot of space in the database I guess.
Your videos are helping me a lot in understanding SQL and Database design! I hope you could do something similar to this (creating SQL code from a DB design) but with Join tables.
Thanks, I'm glad they have helped. Great suggestion!
Hello, I'm a Highschool Student, I'm interested on Creating Database for my Research, how do you that 😮. I'm very impressed how you explain
Thanks! I’ve got many other videos on my channel with examples of creating databases.
Under the 'CREATE TABLE elec_usage', you have used 'fk_usage'. Should that be 'pk_usage' instead due to it being a primary key?
Aah yes good point. Yes it should be. Thanks for letting me know!
Hey, I'm working on a hospital appointment system right now and one of the issues is fixing an appointment between a patient and doctor for a given date and time. Suppose each consultation appointment is in 30 minutes block, do you think it's a good idea to have a separate table each for dates and times?
Good question! I don't see the need to have a separate table for "all possible dates and times". I assume it could be done by showing input fields on the screen for the user to select from. They could select a preferred date, and a time, where the time is a 30-minute block (e.g. 9:00 9:30, 10:00). You could then save this selected value in the table that stores the appointment information. Hope that helps!
@@DatabaseStar Thank you for replying! I was thinking from the input field's perspective as well where users can immediately see the available timings. By designing a separate table for, I can retrieve this list with a simple query i.e. select * from timeslots where status != 'booked'. A stored procedure updates the status of the timeslot if it was booked or made available again. But this will take up a lot of space in the database I guess.