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

SQL Module 2

1. Create a customer table with columns for customer ID, first name, last name, email, address, city, zip code, and state. 2. Insert 5 records into the customer table with sample data. 3. Select the first name and last name columns from the customer table. 4. Select records from the customer table where the first name starts with "G" and the city is "San Jose".
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

SQL Module 2

1. Create a customer table with columns for customer ID, first name, last name, email, address, city, zip code, and state. 2. Insert 5 records into the customer table with sample data. 3. Select the first name and last name columns from the customer table. 4. Select records from the customer table where the first name starts with "G" and the city is "San Jose".
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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',
'[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'

You might also like