Informatics Practices

Write suitable SQL query for the following:

I. To display the average score from the test_results column (attribute) in the Exams table.

II. To display the last three characters of the registration_number column (attribute) in the Vehicles table. (Note: The registration numbers are stored in the format DL-01-AV-1234)

III. To display the data from the column (attribute) username in the Users table, after eliminating any leading and trailing spaces.

IV. To display the maximum value in the salary column (attribute) of the Employees table.

V. To determine the count of rows in the Suppliers table.

SQL Queries

2 Likes

Answer

I.

SELECT AVG(test_results) 
FROM Exams;

II.

SELECT RIGHT(registration_number, 3) 
FROM Vehicles;

III.

SELECT TRIM(username) 
FROM Users; 

IV.

SELECT MAX(salary) 
FROM Employees;

V.

SELECT COUNT(*) 
FROM Suppliers; 

Answered By

3 Likes


Related Questions