SQL Queries - Assignment-4
Assignment 4
--------------------------
Write SQL Queries for the following (based on the above data). You can use SQL Server Management Studio to run your queries:
Hint/Note : You will be using the features here. [1]. AND, OR & NOT
- Select (Display) all the residents who were born before 1970.
- Select (Display) all the flats belonging to block 'A' and area in square feet is less than 1300
- Select (Display) all residents who resides either in Block A or her/his names starts with 'A' ( No JOIN required)
- Select (Display) all residents who born between 1960 and 1970
- Select (Display) all residents who are not of block 'A'
- Select (Display) all flats belonging to block 'A' and not ground floor
- Select (Display) all residents whose phone number starts with 9 and having gmail account
- Select (Display) all the flat details which are more than 1200 sqft but less than 1350 sqft
- Select (Display) all the flats on second floor but not in block 'B'
- Select (Display) all the active users created in the year 2022
Let's understand both of the above concepts i.e. AND, OR & NOT.
AND, OR , NOT
The WHERE clause can be combined with AND, OR, and NOT operators..The AND and OR operators are used to filter records based on more than one condition:
The AND operator displays a record if all the conditions separated by AND are TRUE.
The OR operator displays a record if any of the conditions separated by OR is TRUE.
The NOT operator displays a record if the condition(s) is NOT TRUE.
Comments
Post a Comment