Reading and Writing Data with SQL. |
1. What is SQL ?
SQL Stands for Structured Query Language, is a non-procedural language used for accessing field and record values in relational database tables.
2. What are the basics (types) of SQL ?
The Basics of SQL consists of a number of parts,
1. Query Commands
a. Basic query: The most simple of queries retrieves all records from a single table. It uses the SELECT statement and the FROM clause
b. Filtered query: It uses a WHERE clause to include or exclude specific records.
c. Sorted query: it uses the ORDER BY clause to retrieve records in a specific sorted order.
d. Aggregated query: it uses the GROUP BY clause or a HAVING clause for summarizing, grouping, or aggregating of records into summarized record sets.
e. Join query: it joins tables together, returning records from multiple tables.
f. Nested queries: it is also known as subquery, which is a query contained within another query.
g. Composite queries: it is a query that merges multiple query results together, most often using the UNION keyword.
2. Data change commands
a. INSERT: This command is used to add new records to a table.
b. UPDATE: This command allows changes to one or more records in a table
c. DELETE: This command allows deletion of one or more records from a table.
3.Database structure change commands
These commands allow alterations to metadata.
a. CREATE TABLE
b. ALTER TABLE
c. DROP TABLE
4.What is join query ? write down the types of Join queries.
Join query: it joins tables together , returning records from multiple tables.
There are different types of Joins,
i. Inner join
ii. Cross join :
iii. Outer join
a. Left outer join
b. Right outer join
c. Full outer join.
iv. Self join:
5. What does it mean by filtered query?
A filter query used uses a WHERE clause to include or exclude specific data.
6. What does it mean by sorted query?
Sorting uses the ORDER BY clause to retrieve records in a specific sorted order.
7. What does it mean by aggregate query?
A database query with aggregate function or group unction like SUM, MAX, MIN, AVG, COUNT is called aggregate query.
8. What does it mean by join query?
A join query joins table together, returning records from multiple tables.
9. What does it mean by Nested query?
A nested query is a query that is embedded into another query. It is also called subquery.
10. What does it mean by composite queries?
A composite query is a query that merges multiple query result together, most often using UNION keyword.
11. Write about data change command shortly?
Data change command or DML command is used to change data. INSERT, UPDATE, DELETE, MERGE is the examples of data change command.
12. Write about database structure commands shortly?
Data structure command or DDL commands are used to change database structure. CREATE, ALTER, DROP, RENAME, TRUNCATE is the examples of database structure command.
13. What does it mean by Cartesian product?
A cross join merges all records in one table with all records in another table, regardless of any matching values. It is also called cross join.
14. What does it mean by sefl join?
A self join simply joins a table to itself and is commonly used with a table containing a hierarchy of records.
0 Comments