SQL Grade12 Program
SQL Grade12 Program
Create a student table with the student id, name, and marks as attributes where the student id
is the primary key.
Ans.:
Ans.:
5.
Find the min, max, sum, and average of the marks in a student marks table.
Ans.:
Ans.:
7. Write a SQL query to order the (student ID, marks) table in descending order of the marks.
Ans.:
8. Write a SQL query to display the marks without decimal places, display the reminder after
diving marks by 3 and display the square of marks.
Ans.:
Ans.:
10Remove extra spaces from left, right and both sidesfrom the text - " Informatics Practices Class
XII "
Ans.:
select ltrim(" Informatics Practices Class XII ") "Left Spaces", rtim(" Informatics Practices Class XII ")
"Right Trim", trim(" Informatics Practices Class XII ");
Ans.:
12. Display dayname, monthname, day, dayname, day of month, day of year for today's date
13. write sql command to create two table sales and customer and insert values in it
Coachid Coachname Age Sport Dateofapp Pay Gender
15. Write a query to display report showing coachname, pay, age and bonus (15% of pay) for all
coaches. (Refer table ‘Club’ of Practical 13)
Solution SELECT
Coachname,
Pay,
Age,
FROM
Club;
16. write sql command to create two table sales and customer and insert values in it
Solution
customer_name VARCHAR(100),
customer_email VARCHAR(100),
customer_phone int(20)
);
sale_date DATE,
customer_id INT,
);
VALUES
VALUES
Solution
FROM sales
ON sales.customer_id = customer.customer_id;
FROM sales
ON sales.customer_id = customer.customer_id;