मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Construct the following SQL statement in the student table- SELECT statement using ORDER BY clause. - Computer Science

Advertisements
Advertisements

प्रश्न

Construct the following SQL statement in the student table-

SELECT statement using ORDER BY clause.

थोडक्यात उत्तर
Advertisements

उत्तर

ORDER BY clause

The ORDER BY clause in SQL is used to sort the data in either ascending or descending based on one or more columns.
1. By default ORDER BY sorts the data in ascending order.
2. We can use the keyword DESC to sort the data in descending order and the keyword ASC to sort in ascending order.

The ORDER BY clause is used as:

SELECT <column-name> [,<column-name>,….] FROM <table-name> ORDER
BY <column1>,<column2>, …ASC\ DESC;

For example :

To display the students in alphabetical order of their names, the command is used as
SELECT * FROM Student ORDER BY Name;

The above student table is arranged as follows :

Admno Name Gender Age Place
104 Abinandh M 18 Chennai
101 Adarsh M 18 Delhi
102 Akshith M 17 Bangalore
100 Ashish M 17 Chennai
103 Ayush M 18 Delhi
106 Devika F 19 Bangalore
107 Hema F 17 Chennai
105 Revathi F 19 Chennai
  
shaalaa.com
SQL Commands and Their Functions
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 12: Structured Query Language (SQL) - Evaluation [पृष्ठ २३१]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 12 Structured Query Language (SQL)
Evaluation | Q 4. (ii) | पृष्ठ २३१

संबंधित प्रश्‍न

Write a short note on Primary key constraints.


Write any three DDL commands.


Write a SQL statement using the DISTINCT keyword.


Write the different types of constraints and their functions.


Consider the following employee table. Write SQL commands for the question.

EMP CODE NAME DESIG PAY ALLO WANCE
S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000

To display all employees whose allowance is between 5000 and 7000.


Consider the following employee table. Write SQL commands for the question.

EMP CODE NAME DESIG PAY ALLO WANCE
S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000

To remove the employees who are mechanics.


Consider the following employee table. Write SQL commands for the question.

EMP CODE NAME DESIG PAY ALLO WANCE
S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000

To add a new row.


Consider the following employee table. Write SQL commands for the question.

EMP CODE NAME DESIG PAY ALLO WANCE
S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000

To display the details of all employees who are operators.


What are the components of SQL? Write the commands in each.


Write a SQL statement to create a table for employees having any five fields and create a table constraint for the employee table.


Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×