0% found this document useful (0 votes)
34 views

SQL1

The document creates a customer database and table to store customer details. It inserts 5 records into the customer details table with fields for customer ID, name, email, address, city, state and zipcode. It then selects and displays the customer first and last name from the table, and specifically selects the record where the first name starts with G and the city is San Jose.

Uploaded by

Hari
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

SQL1

The document creates a customer database and table to store customer details. It inserts 5 records into the customer details table with fields for customer ID, name, email, address, city, state and zipcode. It then selects and displays the customer first and last name from the table, and specifically selects the record where the first name starts with G and the city is San Jose.

Uploaded by

Hari
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

--Create Database

Create Database Customer;

--Use Database
Use Customer;

--Create Table(Create a customer table which comprises of these columns �


�customer_id�, �first_name�,�last_name�, �email�, �address�, �city�,�state�,�zip�)
Create table Customer_Details(
Customer_ID Int Primary key,
Customer_First_Name Varchar(50) not null,
Customer_Last_Name Varchar(50) default'.',
Customer_Email Varchar(70) not null,
Customer_Address Varchar(150) not null,
Customer_City Varchar(50),
Customer_State Varchar(50),
Customer_Zipcode Int
);

--Insert into the table(Insert 5 new records into the table)


Insert into Customer_Details
(Customer_ID,Customer_First_Name,Customer_Email,Customer_Address,Customer_City,Cust
omer_State,Customer_Zipcode)
values(123,'Gabby','[email protected]','No 7
Plaza','San Jose','California',95112);
Insert into Customer_Details values
(456,'Sam','Lisa','[email protected]','20th Ave','Denver','Colorado',80202),
(789,'Zor','Kam','[email protected]','1275 B Block','Atlanta','Georgia',30303),
(901,'Mc','Cool','[email protected]','D 37','Dover','Delaware',19901),
(234,'Holly','Biz','[email protected]','06 7th CT','Boise','Idaho',83702)
;

--Displaying the table with Condition(Select only the �first_name� & �last_name�
columns from the customer table & Select those records where �first_name� starts
with �G� and city is �San Jose)
Select * from Customer_Details;
Select Customer_First_Name,Customer_Last_Name from Customer_Details;
Select * from Customer_Details where Customer_First_Name like 'G%' and
Customer_City like 'San Jose';

You might also like