Demo entry 6683979

sql

   

Submitted by anonymous on Dec 14, 2017 at 06:51
Language: SQL. Code size: 1.1 kB.

CREATE VIEW client_info AS
SELECT Client_ID,Name,Gender,Tele_number,Age,office.Office_ID,City,Address,License_ID from mydb.client
  INNER JOIN office  ON client.Office_id = office.Office_ID
  INNER JOIN license l ON client.Client_ID = l.CLIENT_Client_ID;

CREATE VIEW car_info AS
SELECT Car_ID,Color,Model,Staff_ID,Name,OFFICE_Office_ID FROM car
  INNER JOIN mydb.staff ON car.STAFF_Staff_ID_Instructor_ID = staff.Staff_ID;

CREATE VIEW time_table AS
SELECT STAFF_Staff_ID_Instructor_ID AS Staff_ID,Name,lesson.DATE,lesson.Time,'lesson' AS type FROM lesson
  INNER JOIN mydb.staff ON lesson.STAFF_Staff_ID_Instructor_ID = staff.Staff_ID
UNION
  SELECT test.STAFF_Staff_ID AS Staff_ID,Name,test.Date,test.Time,'Test' AS type FROM test
  INNER JOIN mydb.staff ON test.STAFF_Staff_ID = staff.Staff_ID
UNION
  SELECT interview.STAFF_Staff_ID_Instructor_ID AS Staff_ID,Name,interview.Date,interview.Time,'Interview' AS type FROM interview
  INNER JOIN mydb.staff ON interview.STAFF_Staff_ID_Instructor_ID = staff.Staff_ID
  ORDER BY Date DESC ;

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).