Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Northwoods database) Display the number of classes by days, and time of the day

ID: 3756879 • Letter: #

Question

(Northwoods database) Display the number of classes by days, and time of the day, formatted as shown below: 4. Number of dlasses MTWRE08:00 a.m. MTWRE09:00 a.m. 02:00 p.m. 03:00 p.m. 08:00 a.m. 09:00 a.m. MWE MWE MWF 7 MWF10:00 a.m 2 TR TR o TR TR 02:00 p.m. 08:00 a.m. 09:30 a.m. 11:00 a.m. Now replace the day expression with a more meaningful explanation, and order by days. Remove leading zeroes from the time, as shown below: 5. Number of dasses very dav of the Week 2 Everv day of the week 3Mon- Wed -Fri Mon-Wed Fri Mon- Wed Fri Mon- Wed- Fri Mon-Wed-Fri Tues Thurs Tues Thurs TuesThurs ii Tues -Thurs 8:00 a.n 9:00 a.m. 9:00 a.m. 10:00 a.m. 3:00 p.M 2:00 p.m. 8:00 a.. 2:00 p.m. 8:00 a.m. 11:00 a.n. 9:30 a. 1

Explanation / Answer

There are three tables, but I am giving these tables name as question No. as Table1 for question 4, Table2 for question 5 and Table3 for second sheet question.

Answer 1:

In question 4, there are three attributes: Days,Time and Number of classes. In Time attribute, it is stored as AM and PM format which is only possible when we store data in VARCHAR format otherwise Internally the date and time are stored as a number. Whether it's displayed in a 12 or 24 hour clock is up to the program formatting it for display. So, as display in table:-

Sql> CREATE TABLE table1 (

Days varchar(7),

Time varchar(10),

Number_of_classes int

);

Insertion:- insert all data into table1 as mentioned.

INSERT INTO table1(Days , Time , Number_of_classes)
VALUES('MTWRF' , '08:00 a.m.' , 2)
('MTWRF' , '09:00 a.m.' , 1)
('MWF' , '02:00 p.m.' , 1)
('MWF' , '03:00 p.m.' , 1)
('MWF' , '08:00 a.m.' , 1)
('MWF' , '09:00 a.m.' , 1)
('MWF' , '10:00 a.m.' , 2)
('TR' , '02:00 p.m.' , 1)
('TR' , '08:00 a.m.' , 1)
('TR', '09:00 a.m.' , 1)
('TR' , '11:00 a.m.' , 1);

Answer 2:

In this table, only date is expended its length.

Sql> CREATE TABLE table2 (

Days varchar(25),

Time varchar(10),

Number_of_classes int

);

Insertion:- Insert data into table2 as mentioned.

INSERT INTO table2(Days , Time , Number_of_classes)
VALUES('Every day of the week' , '8:00 a.m.' , 2)
('Every day of the week' , '9:00 a.m.' , 1)
('Mon - Wed - Fri' , '9:00 a.m.' , 1)
('Mon - Wed - Fri' , '10:00 a.m.' , 2)
('Mon - Wed - Fri' , '3:00 p.m.' , 1)
('Mon - Wed - Fri' , '2:00 p.m.' , 1)
('Mon - Wed - Fri' , '8:00 a.m.' , 1)
('Tues - Thurs' , '2:00 p.m.' , 1)
('Tues - Thurs' , '8:00 a.m.' , 1)
('Tues - Thurs' , '11:00 a.m.' , 1)
('Tues - Thurs' , '9:00 a.m.' , 1);

Answer 3:

In this table, C_SEC_ID should be primary key. And no more information about database so I am just create a table simply. And all ID terms as not null vaues.

Sql> CREATE TABLE table3 (

C_SEC_ID int AUTO_INCREMENT ,

COURSE_ID INT NOT NULL,

TERM_ID INT NOT NULL,

SEC_NUM INT,

F_ID INT NOT NULL,

C_SEC_DAYS VARCHAR(7),

C_SEC_TIME VARCHAR(10),

C_SEC_DURATION INT,

LOC_ID INT NOT NULL,

MAX_ENRL INT,

PRIMARY KEY (C_SEC_ID)

);

Insertion:- Here C_SEC_ID is auto increment so need to add into insert into clause.

INSERT INTO table3( COURSE_ID ,TERM_ID ,SEC_NUM ,F_IDINT ,C_SEC_DAYS ,C_SEC_TIME ,
C_SEC_DURATION , LOC_ID , MAX_ENRL )
VALUES(1,4,1,2,'MWF','01-AUG-18',50,1,140),
(1,4,2,3,'TR','01-AUG-18',75,7,35),
(1,4,3,3,'MWF','01-AUG-18',50,2,35),
(2,4,1,4,'TR','01-AUG-18',75,6,35),
(2,5,2,4,'TR','01-AUG-18',75,6,35),
(3,5,1,1,'MWF','01-AUG-18',50,5,30),
(3,5,2,1,'MWF','01-AUG-18',50,5,30),
(4,5,1,5,'TR','01-AUG-18',75,3,35),
(5,5,1,2,'MWF','01-AUG-18',50,5,35),
(3,5,2,2,'MWF','01-AUG-18',50,5,30),
(1,6,1,1,'MTWRF','01-AUG-18',90,1,50),
(2,6,1,2,'MTWRF','01-AUG-18',90,6,35),
(3,6,1,3,'MTWRF','01-AUG-18',90,5,35);

I am solving this question as mentioned that only create tables. If there is any problem please do not rate it as bad.

Thank you.