Presentation is loading. Please wait.

Presentation is loading. Please wait.

(SQL - Structured Query Language)

Similar presentations


Presentation on theme: "(SQL - Structured Query Language)"— Presentation transcript:

1 (SQL - Structured Query Language)
MS Access QUERY LANGUAGES (SQL - Structured Query Language)

2 DATA HIERARCHY A database holds group of files often called tables
TABLE OR FILE Related records grouped together Related fields grouped together RECORD Characters are grouped together FIELD Characters are letters, number, and special symbols CHARACTER

3 DATA HIERARCHY FIELD: EmpDateHired CHARACTER: R DATABASE: LeonelDB.mdb
TABLE: tblDriver RECORD: groups of fields

4 DATA HIERARCHY FIELD: EmpDateHired CHARACTER: R DATABASE: LeonelDB.mdb
TABLE: tblDriver RECORD: groups of fields

5 QUERY LANGUAGES (SQL - Structured Query Language)
A query can be thought of as a request of the database, the response to which is a new table, which we will refer to as a result table. A table whose data are actually stored in the database is called a base table. A table that is not stored, such as the result table of a query, is called a derived table. A view is a query expression that has given a name, and is stored in the database. Whenever the expression or view is executed, it creates a result table. Therefore, a view is often referred to as a virtual table.

6 QUERY LANGUAGES (SQL Components)
A data definition language, or DDL, component, allow the definition (creation) of database components such as table. A data manipulation language, or DML, component, allow manipulation of database components. A data control language, or DCL, component, to provide internal security for database.

7 QUERY LANGUAGES (Access Query Types)
Select Query: These queries return data from one or more tables and display the results in a result table. The table is usually updatable, which means that we can change the data in the table and the changes will be reflected in the underlying tables. It can also be used to group rows and calculate sums, counts, averages, and other type of totals for these groups.

8 QUERY LANGUAGES (Access Query Types – Select Query)

9 QUERY LANGUAGES (Access Query Types)
Action Queries: These are queries that take some form of action. The action queries are: Make-Table Query A query that is designed to create a new table with data from existing table. Delete Query A query that is used to delete rows from a given table or tables. Append Query A query that is used to append additional rows to bottom of an existing table. Update Query A query that is used to make changes to one or more rows in a table.

10 QUERY LANGUAGES (Access Query Types – Make-Table Query)

11 QUERY LANGUAGES (Access Query Types – Delete Query)

12 QUERY LANGUAGES (Access Query Types – Append Query)

13 QUERY LANGUAGES (Access Query Types – Update Query)

14 QUERY LANGUAGES (Access Query Types)
SQL Queries: These are queries that must be entered in SQL View. The SQL queries are: Union Query A query that creates the union of two or more tables. Pass-Through Query A query that passes the un-interpreted SQL statement through to an external database. Data-Definition Query These are queries that use the DDL component of SQL, such as CREATE TABLE or CREATE INDEX.

15 QUERY LANGUAGES (Access Query Types – Union Query)

16 QUERY LANGUAGES (Access Query Types – Data-Definition Query)

17 QUERY LANGUAGES (Access Query Types)
Crosstab Query This is a special type of select query that displays values in a spreadsheet format, with both row and column headings. Parameter Query When the query asks for information from the user, it is referred to as a parameterized, or parameter query.

18 QUERY LANGUAGES (Access Query Types – Crosstab Query)

19 QUERY LANGUAGES (Access Query Types – Parameter Query)

20 QUERY LANGUAGES (JOINS)
The various types of joins are among the most important and useful of the relational algebra operations. Loosely speaking, joining two tables involves combining the rows of two tables based on comparing the values in selected columns.

21 QUERY LANGUAGES (JOINS - Types)
Inner Join Only include rows where the joined fields from both tables are equal. Left Outer Join Include ALL records from LEFT table and only those records from the RIGHT tables where the joined fields are equal. Right Outer Join Include ALL records from RIGHT table and only those records from the LEFT tables where the joined fields are equal. Cartesian Product The rows of TABLE1 x TABLE2 are formed by combining each row of TABLE1 with each row of TABLE2 to form a new row.

22 QUERY LANGUAGES (JOINS – Sample Tables)

23 QUERY LANGUAGES (JOINS – Inner Join)

24 QUERY LANGUAGES (JOINS – Inner Join)

25 QUERY LANGUAGES (JOINS – Left Join)

26 QUERY LANGUAGES (JOINS – Left Join)

27 QUERY LANGUAGES (JOINS – Right Join)

28 QUERY LANGUAGES (JOINS – Right Join)

29 QUERY LANGUAGES (JOINS – Cartesian Product)

30 QUERY LANGUAGES (JOINS – Cartesian Product)
5 X 63 = 315


Download ppt "(SQL - Structured Query Language)"

Similar presentations


Ads by Google