Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 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','Gabby@gmail.com','No 7
Plaza','San Jose','California',95112);
Insert into Customer_Details values
(456,'Sam','Lisa','Sam@yahoo.com','20th Ave','Denver','Colorado',80202),
(789,'Zor','Kam','Zor.1@aol.com','1275 B Block','Atlanta','Georgia',30303),
(901,'Mc','Cool','McCool@live.com','D 37','Dover','Delaware',19901),
(234,'Holly','Biz','Holly@proton.com','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