You are on page 1of 19

1

CSSE-604 SOFTWARE
TESTING
Assignment #2:SQL Queries
Course Instructor: Sir Fazeel Shaikh
Group members:
Muhammad Uzair Khan
(EB19103086)
2

SQL Queries
1. Insert Into
The INSERT INTO statement is used to insert new records in a table.
3

2. SUB QUERY
A Subquery or Inner query or a Nested query is a query within another SQL query.
4

3. Select Into
The SELECT INTO statement copies data from one table into a new table.
5

4. NULL (IS NULL)


A field with a NULL value is a field with no value.
6

5. HAVING
The HAVING clause was added to SQL because the WHERE keyword cannot be used with
aggregate functions.

6. EXISTS
The EXISTS operator is used to test for the existence of any record in a subquery.
7

7. WHERE
WHERE Clause in MySQL is a keyword used to specify the exact criteria of data or rows that
will be affected by the specified SQL statement.
8

8. SELF JOIN
A self-join is a regular join, but the table is joined with itself.
9

9. INNER JOIN:
The INNER JOIN keyword selects records that have matching values in both tables.
10

10. OUTER JOIN:


The OUTER JOIN keyword returns all records when there is a match in table1 or table2
records.
11

11. RIGHT JOIN:


The RIGHT JOIN returns all the columns from the table on the right even if no matching rows
have been found in the table on the left. Where no matches have been found in the table on
the left, NULL is returned.
12

12. LEFT JOIN:


The LEFT JOIN returns all the rows from the table on the left even if no matching rows have
been found in the table on the right.

13. MIN:
The MIN() function returns the smallest value of the selected column.
13

14. MAX:
The MAX() function returns the largest value of the selected column.

15. AVG:
The AVG() function returns the average value of a numeric column.
14

16. SUM:
The SUM() function returns the total sum of a numeric column.

17. COUNT:
The COUNT() function returns the number of rows that matches a specified criterion.
15

18. AND/OR:
The AND and OR operators are used to filter records based on more than one condition:
16

19. UNION ALL:


The UNION operator is used to combine the result-set of two or more SELECT statements.

20. CASE:
The CASE expression goes through conditions and returns a value when the first condition
is met (like an if-then-else statement).
17

21. STORED PROCEDURE:


A stored procedure is a prepared SQL code that you can save, so the code can be reused
repeatedly.
18

22. INDEX:
An index is a data structure such as B-Tree that improves the speed of data retrieval on a
table at the cost of additional writes and storage to maintain it.

23. PARTITION TABLE:


Partitioning is the database process where very large tables are divided into multiple smaller
parts.
19

24. VIEW:
In SQL, a view is a virtual table based on the result-set of an SQL statement.

You might also like