Create SCHEDULE table in SQL

Question:

Create SCHEDULE table

Refer the below schema and create the SCHEDULE.

Column NameDatatypeSizeConstraintConstraint nameReference table – Column name
Schedule_idVarchar23Primary keyPK_SCHEDULE 
Travel_dateDate    
SourceVarchar220   
DestinationVarchar220   
Bus_noNumber11Foreign key,FK_SCHEDULE_BUSESBuses – bus_no
DurationNumber11   
Quiz for exam - Create SCHEDULE table

Code:

dd2.sql

create table SCHEDULE(
	Schedule_id varchar2(3),
	Travel_date date,
  	Source varchar2(20),
  	Destination varchar2(20),
  	Bus_no number(11),
  	Duration number(11),
  	constraint PK_SCHEDULE primary key(Schedule_id)
	constraint FK_SCHEDULE_BUSES foreign key(Bus_no) references Buses(Bus_no)
);

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x