in Technology by
What are some common clauses used with SELECT query in SQL?

1 Answer

0 votes
by

Some common SQL clauses used in conjuction with a SELECT query are as follows:

  • WHERE clause in SQL is used to filter records that are necessary, based on specific conditions.
  • ORDER BY clause in SQL is used to sort the records based on some field(s) in ascending (ASC) or descending order (DESC).
    SELECT *
    FROM myDB.students
    WHERE graduation_year = 2019
    ORDER BY studentID DESC;
    
  • GROUP BY clause in SQL is used to group records with identical data and can be used in conjuction with some aggregation functions to produce summarized results from the database.
  • HAVING clause in SQL is used to filter records in combination with the GROUP BY clause. It is different from WHERE, since WHERE clause cannot filter aggregated records.
    SELECT COUNT(studentId), country
    FROM myDB.students
    WHERE country != "INDIA"
    GROUP BY country
    HAVING COUNT(studentID) > 5;

Related questions

0 votes
    The SQL query to create a new database COMPANY * a) SELECT DATABASE COMPANY; b) CREATE DATABASE COMPANY; c) ... All of the above Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    An application developer can guard against certain snapshot anomalies by appending a ______ clause to the SQL ... topic in section Concurrency Control of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Which command clauses is used to delete tuples from a database table? Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    The ___________ class adds a rounded border around an element with a gray background color and some padding. ... .alert .jumbotron Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    If I have a view in SQL which contains various computed columns, some of which could be very expensive, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    What is the difference between pre-select and pre-query?...
asked Dec 18, 2020 in Technology by JackTerrance
0 votes
    How many records can a select query return? How many records can a SOSL query return?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    We are using MyBatis 3.0.3 & Spring 3.0.5 in our project. We are trying to implement data level ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I have a search method that takes a list of ID's and I wish to restrict the query based on the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    What are some common use cases for NFTs?...
asked Jan 21, 2023 in Technology by JackTerrance
0 votes
    What are some common mobile application testing methods?...
asked Feb 8, 2021 in Technology by JackTerrance
+1 vote
    Enlist some common tests that are performed on APIs....
asked Oct 15, 2020 in Technology by JackTerrance
0 votes
    I am running following PHP code to interact with a MS Access database. $odbc_con = new COM("ADODB. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I am running following PHP code to interact with a MS Access database. $odbc_con = new COM("ADODB. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I am running following PHP code to interact with a MS Access database. $odbc_con = new COM("ADODB. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
...