Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

SQL Module 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Module-2 Assignment

Problem Statement:
You have successfully cleared the first semester. In your second semester you will learn how to create
tables, work with where clause and basic operators

Tasks to be done:

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


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

2. Insert 5 new records into the table

3. Select only the ‘first_name’ & ‘last_name’ columns from the customer table

4. Select those records where ‘first_name’ starts with “G” and city is ‘San Jose’
create table Customers
(customer_id varchar(100), first_Name varchar(100),
last_Name varchar(100), email nvarchar(100),
address varchar(100), city varchar(100), zip int ,
state varchar(100));
INSERT INTO Customers
(customer_id, first_name, last_name, email, address, city, zip, state)
values ( 1, 'Cardinal','Tom B. Erichsen',
'Skagen21@gamil.com','Stavanger',
'Sokan',545456, 'Norway');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values ( 2, 'Arti', 'Alex', 'alp3@yahoo.com',
'model town', 'ranny', 656895, 'kerala');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values (3, 'Maggy','John', 'samj@rediff.com', 'g.t.road', 'Patiala', 151004,'Punjab');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values(4, 'George', 'Jacob', 'subinmgr@gmail.com','mgroad', 'San Jose', 878961, 'USA');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values(5, 'Ceena', 'kate', 'sskc@gmail.com','down town', 'Florida', 458712, 'USA');
select first_name, last_name
from Customers
select *
from Customers
where first_name like '%g%' and city = 'San Jose'

You might also like