Professional Documents
Culture Documents
Practical File
Batch: 2020-23
D Write an SQL query to display Fname, Age, Gift where Age > 35 from the table
select Firstname,Age,Gift from firsttable where age>35
E) Write an SQL query to display all record where Gift > 200 and Age >20
select*from firsttable where gift>200 and age>20
F) Write an SQL query to display all record where Gift > 200 or Age >20
select*from FirstTable where Gift>200 or Age>20
Assignment 3: Queries for aggregate functions for table Test1
a. Write SQL query to add the age of all records.
select SUM(AGE)as "TOTAL OF AGE COL" from firsttable
C)Write a query to display the name and age of the youngest member
select FIRSTNAME from firsttable where age=(select MIN(AGE)from firsttable)
D)Write a query to count the number of candidates whose age in more than 30.
select COUNT(Firstname)from firsttable where age>30
E)Write a query to find the name and cost of the costliest gift.
select FirstName from firsttable where gift=(select MAX(gift)from firsttable)
Assignment 4: Applying functions and modification queries
C Write an SQL query to display the table in ascending order of their names
select * from EMP_Table order by EMPNAME
D)Write a SQL query that returns the average salary using the alias “Average salary”
Select AVG(SALARY) as “Average Salary” from EMP_TABLE
E)Write a SQL query to display the records of employees whose names start with letter ‘P’ or ‘H’
5. Add construct check to the Marks column (Marks >=0 and Marks<=100)
Alter Table Student2 ADD Constraint Marks check(Marks >=0 and Marks<=100)