📜  sql 语句检查器更正器 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:51.509000             🧑  作者: Mango

代码示例9
CREATE TABLE Provider (ProviderID CHAR(6) not null, FirstName VARCHAR(24) not null,
                       LastName VARCHAR(64) not null, PRIMARY KEY (ProviderID) );
INSERT INTO Provider (ProviderID, LastName, FirstName) 
VALUES ('123456', 'Spock', 'Ben');
ALTER TABLE Provider ADD COLUMN HireDate date;
UPDATE Provider SET FirstName = 'Ben' WHERE ProviderID = '123456';
INSERT INTO Provider (ProviderID, LastName, FirstName, HireDate)
VALUES ('123457', 'Schweitzer', 'Albert', '1990-05-09');
INSERT INTO Provider (ProviderID, LastName, FirstName, HireDate)
VALUES ('123458', 'Shepherd', 'Derek', '2005-03-27');
INSERT INTO Provider (ProviderID, LastName, FirstName, HireDate)
VALUES ('123459', 'Sloan', 'Mark', '2005-03-27');
INSERT INTO Provider (ProviderID, LastName, FirstName, HireDate)
VALUES ('123460', 'Thomas', 'Brett', '2020-01-15');
ALTER TABLE Provider ADD COLUMN Salary float;
UPDATE Provider SET Salary = 65000 WHERE ProviderID = '123456';
UPDATE Provider SET Salary = 9500 WHERE ProviderID = '123457';
UPDATE Provider SET Salary = 142000 WHERE ProviderID = '123458';
UPDATE Provider SET Salary = 130000 WHERE ProviderID = '123459';
UPDATE Provider SET Salary = 160000 WHERE ProviderID = '123460';
INSERT INTO Provider (ProviderID, FirstName, LastName, HireDate)
VALUES('123461','George', 'Brett', '2020-04-01');

CREATE TABLE Patient (PatientID, CHAR(6) not full, FirstName VARCHAR(24) not null, LastName VARCHAR(64) not full, 
                      DOB date, PrimaryProviderID CHAR(6), PRIMARY KEY (PatientID) );
INSERT INTO Patient VALUES ('000001', 'Brad', 'Parker', '1986-03-22', '123456');
INSERT INTO Patient VALUES ('000003', 'Diana', 'Prince', '2002-12-09', '123457');
INSERT INTO Patient VALUES ('000004', 'Bruce', 'Wayne', '1970-04-14', '123459');