Question: CREATE TABLE client( client_id NUMBER(6), client_first_name VARCHAR(100), client_last_name VARCHAR (100), client_email VARCHAR (100), client_phonenumber VARCHAR2 (10), CONSTRAINT client_client_id_pk PRIMARY

CREATE TABLE client(
   client_id NUMBER(6),
   client_first_name VARCHAR(100),
   client_last_name VARCHAR (100),
   client_email VARCHAR (100),
   client_phonenumber VARCHAR2 (10),
   CONSTRAINT client_client_id_pk PRIMARY KEY (client_id)
);

--Create sequence for client table
CREATE SEQUENCE client_seq
START WITH 1
INCREMENT BY 1;

--Create appointment table
CREATE TABLE appointment(
   appointment_id INTEGER,
   appointment_date VARCHAR (100),
   appointment_time VARCHAR (100),
   client_id NUMBER,
   Lawyer_id INTEGER,
   CONSTRAINT appointment_appointment_id_pk PRIMARY KEY (appointment_id),
   CONSTRAINT appointment_client_id_fk FOREIGN KEY (client_id)
   REFERENCES client(client_id),
   CONSTRAINT appointment_Lawyer_id_fk FOREIGN KEY (Lawyer_id)
   REFERENCES Lawyer(Lawyer_id)
);

--Create sequence for appointment table
CREATE SEQUENCE appointment_seq
START WITH 100
INCREMENT BY 10;

--Create lawyer table
CREATE TABLE Lawyer(
   Lawyer_id INTEGER PRIMARY KEY,
   Lawyer_first_name VARCHAR (100),
   Lawyer_last_name VARCHAR (100),
   Lawyer_email VARCHAR (100),
   Lawyer_phonenumber VARCHAR2 (10)
);

--Create sequence for Lawyer table
CREATE SEQUENCE Lawyer_seq
START WITH 100
INCREMENT BY 100;

--Create sequence for Cases Table
CREATE SEQUENCE Cases_seq
START WITH 2
INCREMENT BY 2;

CREATE TABLE Cases(
   Case_id INTEGER PRIMARY KEY,
   Case_type VARCHAR (100),
   Court_roomnumber NUMBER,
   Client_id INTEGER,
CONSTRAINT cases_client_id_fk FOREIGN KEY (Client_id)
   REFERENCES client(client_id)
);

CREATE TABLE CaseLawyer(
   Case_id INTEGER,
   Lawyer_id INTEGER,
CONSTRAINT caselawyer_case_id_fk FOREIGN KEY (Case_id)
   REFERENCES Cases(Case_id),
   CONSTRAINT caselawyer_lawyer_id_fk FOREIGN KEY (Lawyer_id)
   REFERENCES Lawyer(Lawyer_id)
);
Query 1 must contain:

A group function, and A GROUP BY clause do not use JOIN function


Query 2 must contain:

A Having Clause

Must be different query from Query 1 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Query 1 SELECT DepartmentName COUNT AS Total Employees FROM Employ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!