Home > OS >  create table of time_slot from database system concept by korth
create table of time_slot from database system concept by korth

Time:11-11

We all familiar with University dataset that has been given on Database System Concept by Korth. I would like to create the table

time slot (time slot id, day, start time, end time) Bold words are primary key.

I wrote create table command

create table time_slot(
                       time_slot_id varchar (4),
                       s_day varchar(2),
                       start_time time,
                       end_time time,
                       primary key(time_slot_id,s_day,start_time));

The toy dataset that I have to use is like that

insert into time_slot values ('A', 'M', '8', '0', '8', '50');
insert into time_slot values ('A', 'W', '8', '0', '8', '50');
insert into time_slot values ('A', 'F', '8', '0', '8', '50');
insert into time_slot values ('B', 'M', '9', '0', '9', '50');

But my table creation type does not match with the dataset. So I could not insert a row.

Any one have any idea what datatype I need to change to create the table.

CodePudding user response:

It looks like your insert has integer hours and minutes for start and end time while the table has time type fields that should be provided like 08:00:00, 09:50:00. Either change your create table to match the inserts or (recommended) change your inserts to match the table.

  • Related