Part 1. SQL DDL (36 points) You are given a following schema: PublicChauffeurs(L
ID: 3753098 • Letter: P
Question
Part 1. SQL DDL (36 points) You are given a following schema: PublicChauffeurs(License Number, Renewed, Status, Status Date, Driver Type, License Type, Original Issue Date, Name, Sex, Chauffer City, Chauffer State, Record Number) The table is based on a real data set original taken from City of Chicago data portal (located here: https://data.cityofchicago.org/Community-Economic-Development/ Public-Chauffeurs/97wa-y6ff A. Write SQL DDL to create the table. Make sure to look at the data to decide reasonable domains. B. Declare primary and foreign keys as necessary in your SQL code. C. Create at least three reasonable additional attribute-level, tuple-level, NOT NULL, or UNIQUE constraints in your SQL code.Explanation / Answer
CREATE TABLE PublicChauffeurs(
LicenseNumber NUMBER(20) NOT NULL UNIQUE,
Renewed VARCHAR2(12),
Status VARCHAR2(30),
StatusDate Date,
drivertype varchar2(30) check (DriverType in ('Taxi', 'Livery Only','Pedicab','Ambulance Only','Horse-Drawn Only')),
LicenseType VARCHAR2(30),
OriginalIssueDate Date,
Name VARCHAR2(30) NOT NULL,
Sex VARCHAR2(10),
ChaufferCity VARCHAR2(30),
ChaufferState VARCHAR2(30),
RecordNumber VARCHAR2(30),
PRIMARY KEY (LicenseNumber)
);
General Syntax is
Create table "tablename" (
col_name1 Col_Data_Type,
col_name2 Col_Data_Type,
)