Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
58 views3 pages

P9 Section7 MS SQL Upload Code

The document contains SQL commands to create tables for pets, owners, procedure details, and procedure history from raw data tables, and inserts the data from the raw tables into the new tables. The tables created include fields for pet id, name, kind, gender, age, and owner id; owner id, name, surname, address, city, state, full state name, and zip code; procedure type, subcode, description, and price; and pet id, procedure date, type, and subcode.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views3 pages

P9 Section7 MS SQL Upload Code

The document contains SQL commands to create tables for pets, owners, procedure details, and procedure history from raw data tables, and inserts the data from the raw tables into the new tables. The tables created include fields for pet id, name, kind, gender, age, and owner id; owner id, name, surname, address, city, state, full state name, and zip code; procedure type, subcode, description, and price; and pet id, procedure date, type, and subcode.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

USE [pets]

GO

-- Pets

CREATE TABLE Pets (

Petid varchar(10),

[Name] varchar(100),

Kind varchar(100),

Gender varchar(10),

Age int,

OwnerID varchar(10)

INSERT INTO [dbo].[Pets]

SELECT *

FROM [dbo].[RAW_Pets]

-- Owners

CREATE TABLE Owners (

OwnerID varchar(10),

[Name] varchar(100),

Surname varchar(100),

StreetAddress varchar(100),

City varchar(100),

[State] varchar(2),

StateFull varchar(100),

ZipCode varchar(10)
)

INSERT INTO [dbo].[Owners]

SELECT *

FROM [dbo].[RAW_Owners]

-- ProceduresDetails

CREATE TABLE ProceduresDetails (

ProcedureType varchar(100),

ProcedureSubCode varchar(10),

[Description] varchar(100),

Price float

INSERT INTO [dbo].[ProceduresDetails]

SELECT *

FROM [dbo].[RAW_ProceduresDetails]

-- ProceduresHistory

CREATE TABLE ProceduresHistory (

PetID varchar(10),

ProcedureDate date,

ProcedureType varchar(100),

ProcedureSubCode varchar(10)

INSERT INTO [dbo].[ProceduresHistory]


SELECT *

FROM [dbo].[RAW_ProceduresHistory]

You might also like