0% found this document useful (0 votes)
4 views1 page

Create NYCTaxiTripSmall Table in SQL

The document outlines a SQL script that checks for the existence of a table named 'NYCTaxiTripSmall' in the 'dbo' schema and creates it if it does not exist. The table is defined with various columns related to taxi trip data, including pickup and dropoff details, fare amounts, and trip duration. Additionally, it includes a command to copy data from a specified Parquet file into the newly created table.

Uploaded by

Reddy1993
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Create NYCTaxiTripSmall Table in SQL

The document outlines a SQL script that checks for the existence of a table named 'NYCTaxiTripSmall' in the 'dbo' schema and creates it if it does not exist. The table is defined with various columns related to taxi trip data, including pickup and dropoff details, fare amounts, and trip duration. Additionally, it includes a command to copy data from a specified Parquet file into the newly created table.

Uploaded by

Reddy1993
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

IF NOT EXISTS (SELECT * FROM [Link] O JOIN [Link] S ON O.

schema_id =
S.schema_id WHERE [Link] = 'NYCTaxiTripSmall' AND [Link] = 'U' AND [Link] = 'dbo')
CREATE TABLE [Link]
(
[DateID] int,
[MedallionID] int,
[HackneyLicenseID] int,
[PickupTimeID] int,
[DropoffTimeID] int,
[PickupGeographyID] int,
[DropoffGeographyID] int,
[PickupLatitude] float,
[PickupLongitude] float,
[PickupLatLong] nvarchar(4000),
[DropoffLatitude] float,
[DropoffLongitude] float,
[DropoffLatLong] nvarchar(4000),
[PassengerCount] int,
[TripDurationSeconds] int,
[TripDistanceMiles] float,
[PaymentType] nvarchar(4000),
[FareAmount] numeric(19,4),
[SurchargeAmount] numeric(19,4),
[TaxAmount] numeric(19,4),
[TipAmount] numeric(19,4),
[TollsAmount] numeric(19,4),
[TotalAmount] numeric(19,4)
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
-- HEAP
)
GO
COPY INTO [Link]
FROM '[Link]
WITH
(
FILE_TYPE = 'PARQUET'
,MAXERRORS = 0
,IDENTITY_INSERT = 'OFF'
)

You might also like