SQL Multiple choices


Total available count: 51
Subject - Databases
Subsubject - SQL

The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true


 

 

 

 



A


Solution:-

The WHERE clause can be combined with AND and OR operators, to filter the records based on more than one condition the AND and OR operators are used:

  1. Displays a record of all the conditions separated by AND are TRUE by the AND operator
  2. Displays a record if any of the conditions separated by OR is TRUE by the OR operator

AND Syntax

SELECT column1, column2, column3, ...FROM table_name WHERE conditionA AND conditionB AND conditionC ...;

OR Syntax 

SELECT column1, column2, column3, ...FROM table_name WHERE conditionA OR conditionB OR conditionC ...;

AND Example
The following SQL statement selects all fields from "SlightBook" where the course is "HTML" AND Duration is "6 Months":

Example

SELECT * FROM SlightBook WHERE course='HTML' AND Duration='6 Months';

OR Example
The following SQL statement selects all fields from "SlightBook" where the course is "HTML" OR "CSS":

Example

SELECT * FROM SlightBook WHERE course='HTML' OR City='CSS';


 




Next 5 multiple choice(s)

1

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

2

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

3

With SQL, how do you select all the columns from a table named "Persons"?

4

With SQL, how do you select a column named "FirstName" from a table named "Persons"?

5

Which SQL statement is used to insert new data in a database?

Comments