How to Create SQL Code from a Database Design

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 9

  • @Gasaky
    @Gasaky 10 місяців тому +1

    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.

    • @DatabaseStar
      @DatabaseStar  10 місяців тому

      Thanks, I'm glad they have helped. Great suggestion!

  • @NATE-dq2uo
    @NATE-dq2uo 7 місяців тому

    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

    • @DatabaseStar
      @DatabaseStar  7 місяців тому

      Thanks! I’ve got many other videos on my channel with examples of creating databases.

  • @FoxMacDonald
    @FoxMacDonald 2 роки тому +1

    Under the 'CREATE TABLE elec_usage', you have used 'fk_usage'. Should that be 'pk_usage' instead due to it being a primary key?

    • @DatabaseStar
      @DatabaseStar  2 роки тому +1

      Aah yes good point. Yes it should be. Thanks for letting me know!

  • @juanadearco6356
    @juanadearco6356 2 роки тому

    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?

    • @DatabaseStar
      @DatabaseStar  2 роки тому +1

      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!

    • @juanadearco6356
      @juanadearco6356 2 роки тому

      ​@@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.