📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 204question

STRUCTURED QUERY LANGUAGE (SQL) · Part 12

Chapter 2: 3 · COMPUTER SCIENCE

the information is retrieved. • Column-list includes one or more columns from which data is retrieved. For example to view only admission number and name of students from the Student table the command is given as follows: If the Student table has the following data: 12th Computer Chapter - - Structured Query Language Admno Name Gender Age Place Ashish M Chennai Adarsh M Delhi Akshith M Bangalore Ayush M Delhi Abinandh M Chennai Revathi F Chennai Devika F Bangalore Hema F Chennai SELECT Admno, Name FROM Student; The above SELECT command will display the following data: Admno Name Ashish Adarsh Akshith Ayush Abinandh Revathi Devika Hema To view all the fields and rows of the table the SELECT command can be given as SELECT * FROM STUDENT; . .

. DISTINCT Keyword The DISTINCT keyword is used along with the SELECT command to eliminate duplicate rows in the table. This helps to eliminate redundant data. For Example: SELECT DISTINCT Place FROM Student; Will display the following data as follows : Place Chennai Bangalore Delhi In the above output you can see, there would be no duplicate rows in the place field.

When the keyword DISTINCT is used, only one NULL value is returned, even if more NULL values occur. 12th Computer Chapter - - . . .

ALL Keyword The ALL keyword retains duplicate rows. It will display every row of the table without considering duplicate entries. SELECT ALL Place FROM Student; The above command will display all values of place field from every row of the table without eliminating the duplicate entries. Place Chennai Delhi Ban galore Delhi Che nnai Chen nai Bangalo re Chen nai The WHERE clause in the SELECT command specifies the criteria for getting the desired result.

The general form of SELECT command with WHERE Clause is: SELECT <column-name>[,<column-name>,….] FROM <table-name>WHERE condition>; For example to display the students admission number and name of only those students who

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →