Detailed SQL Practical Programs
Detailed SQL Practical Programs
Question: Write an SQL command to show all the records of the table.
Explanation:
This command retrieves all rows and columns from the Employee table, displaying the complete
SQL Command:
Sample Output:
|-------|---------------|---------|
|1 | Jack | 21000 |
|2 | Robin | 25000 |
|3 | Mary | 17500 |
|4 | Pradeep | 16000 |
|5 | Priya | 22700 |
Question: Write an SQL command to show the salaries more than 20000.
Explanation:
This command retrieves rows from the Employee table where the salary column has values greater
than 20000.
SQL Command:
Sample Output:
|-------|---------------|---------|
|2 | Robin | 25000 |
|5 | Priya | 22700 |
Question: Write an SQL command to show the employee with the highest
salary.
Explanation:
This command retrieves the record of the employee who has the maximum salary in the Employee
table.
SQL Command:
Sample Output:
|-------|---------------|---------|
|2 | Robin | 25000 |
Question: Write an SQL command to show the records of employees whose
Explanation:
This command retrieves all rows from the Employee table where the Employee Name starts with the
letter 'P'.
SQL Command:
Sample Output:
|-------|---------------|---------|
|4 | Pradeep | 16000 |
|5 | Priya | 22700 |
Question: Write an SQL command to show the total salary of all employees.
Explanation:
This command calculates the total salary of all employees in the Employee table using the SUM()
function.
SQL Command:
Sample Output:
| Total_Salary |
|--------------|
| 102200 |