SQL Module 2
SQL Module 2
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:
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',
'[email protected]','Stavanger',
'Sokan',545456, 'Norway');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values ( 2, 'Arti', 'Alex', '[email protected]',
'model town', 'ranny', 656895, 'kerala');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values (3, 'Maggy','John', '[email protected]', 'g.t.road', 'Patiala', 151004,'Punjab');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values(4, 'George', 'Jacob', '[email protected]','mgroad', 'San Jose', 878961, 'USA');
INSERT INTO Customers
(customer_id, first_name, last_name,
email, address, city, zip, state)
values(5, 'Ceena', 'kate', '[email protected]','down town', 'Florida', 458712, 'USA');
select first_name, last_name
from Customers
select *
from Customers
where first_name like '%g%' and city = 'San Jose'