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

SQL Module 2 Assignmnt

A customer table is created with columns for customer ID, first name, last name, email, address, city, state, and zip code. Five records are inserted into the table with details for each customer. A select statement retrieves the first and last name columns from the table. Another select statement finds records where the first name starts with G and the city is San Jose.

Uploaded by

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

SQL Module 2 Assignmnt

A customer table is created with columns for customer ID, first name, last name, email, address, city, state, and zip code. Five records are inserted into the table with details for each customer. A select statement retrieves the first and last name columns from the table. Another select statement finds records where the first name starts with G and the city is San Jose.

Uploaded by

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

--1.

Create a customer table which comprises of these columns – ‘customer_id’,


‘first_name’, ‘last_name’, ‘email’, ‘address’, ‘city’,’state’,’zip’

create table cus (cust_id int primary key,


first_name varchar(20),
last_name varchar(20),
email varchar(20),
address varchar(20),
city varchar(20),
state varchar(10),
zip int)

-- 2.Insert 5 new records into the table


insert into cus values(8,'Gaurav','sharma','[email protected]','San
jose','California','USA',678876);
insert into cus
values(1,'Aman','Singh','amangmail.com','NCR','Delhi','Delhi',7890987);
insert into cus
values(2,'Rohit','kumar','[email protected]','Bandra','Mumbai','MH',123456);
insert into cus values(3,'Aex','John','[email protected]','NC','NY','USA',675431);
insert into cus
values(4,'lucia','Ivan','[email protected]','Toronto','Canada','Canada',456786);

--3.Select only the ‘first_name’ & ‘last_name’ columns from the customer table
select first_name, last_name from cus

--4.Select those records where ‘first_name’ starts with “G” and city is ‘San Jose’
select * from cus where first_name like 'G' and address ='San Jose'

You might also like