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

SQL Program

The document contains SQL queries to: 1. Create a table named 'station' with fields id, name, locality, is_interchange. 2. Rename the 'station' table to 'station_details'. 3. Insert 4 records into the 'station' table with sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views

SQL Program

The document contains SQL queries to: 1. Create a table named 'station' with fields id, name, locality, is_interchange. 2. Rename the 'station' table to 'station_details'. 3. Insert 4 records into the 'station' table with sample data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Write a query to create a table named 'station'.

create table station(id integer,name varchar2(100),locality


varchar2(100),is_interchange integer);

Write a query to rename table 'station' to 'station_details'.


rename station to station_details;

Write a query to insert any 4 records into the 'station' table.


insert into station values(7,'Som','Chennai',3);
insert into station values(2,'Ram','Andra',4);
insert into station values(4,'Sam','Hyd',6);
insert into station values(5,'Jam','kkd',9);

Write a query to update the locality to '21 Changi South Avenue 1, Singapore' for
the station named 'Expo MRT Station'.
update station set locality='21 Changi South Avenue 1,Singapore' where name='Expo
MRT Station';

Write a query to delete the records with station name as 'Kovan MRT station' in the
'station' table
delete from station where name= 'Kovan MRT station';

1.Write a query to display all the details of the 'station' table, which does not
have any interchanges. Display the records in ascending order based on the 'name'.
Hint:
Use is_interchange attribute to check for the condition.
select * from station where is_interchange=0 order by name;

2.Write a query to display all the details of the travel_card table, in which the
name of person is 'Michael'.
select * from travel_card where person_name='Michael'

3.Write a query to display all details of the station whose name starts with the
letter 'K'. Display the records in ascending order based on the name.
select * from station where name like 'K%' order by name;

4.Write a query to display details of the travel_payment whose amount is greater


than 30. Display the records in ascending order based on the entry_time.
select * from travel_payment where Amount>30 order by entry_time;

5.Write a query to display details of the train_arrival_time which does not have
any deviation. Display the records in ascending order based on the metro_train_id.
select * from train_arrival_time where deviation=0 order by metro_train_id;

You might also like