meljun cortes computer application chp 6 ms access sql
Post on 05-Apr-2018
219 Views
Preview:
TRANSCRIPT
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
1/22 7-1
Chapter 7: Microsoft Access II
Learning Outcomes
- Strutured Query Language (SQL)
- SQL Exercise
- Database security
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
2/22
7-2
7.1 Strutured Query Language (SQL)
A SQL statement is an expression that defines an SQL command, such as SELECT,
UPDATE, or DELETE, and includes clauses such as WHERE and ORDER BY. SQL
strings/statements are typically used in queries and in aggregate functions.
A SQL command allows data in a table to be added, updated, shown or deleted.
Select Queries.
Select Table1 Query
Select View.
Select SQL View.
1) Select
Queries
2) Click
Here
3 Select View
4) Select SQL View
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
3/22
7-3
The system generated SQL statement is created.
System Generated
SQL statement
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
4/22
7-4
Changing the SQL command.
Delete the field Name.
Delete Name
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
5/22
7-5
Select X.
Select Yes to save the change.
ClickHere
Select
Yes
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
6/22
7-6
Double click on Table1 Query.
You will see that the Name field is deleted.
Double Click Here
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
7/22
7-7
Searching a particular record using SQL.
Double click on Table1 Query.
Select View SQL View
Delete the ; at the end of FROM Table1.
Add in WHERE [StudID]=1003;.
Click on X.
Select Yes to save.
1) Double Click Here
2) Select View SQL View
3) Add in this
Line
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
8/22
7-8
Double click on Table1 Query.
Peters record is shown.
Double Click Here
Peters
record is
shown
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
9/22
7-9
Double click on Table1 Query.
Select View SQL View
Delete the ; at the end of FROM Table1.
Add in WHERE [Name]= Mary ; .
Click on X.
Select Yes to save.
2) Select View SQL View
1) Double Click Here
3) Add in this
Line
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
10/22
7-10
Double click on Table1 Query.
Marys record is shown.
1) Double Click Here
Marys record is
shown
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
11/22
7-11
7.2 SQL Exercise
Select Table
Double Click on Creat e table by entering data
Key in the fields with the corresponding data types.
Click Yes to save.
Save As Table2.
1)
Select
Table
2) Double Click Here
3) Key
inthese
fields
4) Click Yes
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
12/22
7-12
Double Click on Table2.
Key in the 3 records as shown below.
Click on Yes to save.
1) Double
Click Here
2) Key in
these
records
3) Click Yes to save
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
13/22
7-13
Click on Queries.
Select under Tables/Queries Table:Table2.
Click on the double arrow to select all the fields.
Click Finish.
1) Select
Queries
Select
Table2
Click Here
to select
all fields
Click Finish
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
14/22
7-14
Select Queries.
Select Table2 Query.
Select View SQL View.
Select Queries
Select Table2 Query
Select View
SQL View
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
15/22
7-15
Click on View SQL View.
Delete the ; at the end of FROM Table2.
Add in WHERE [GameID]= 1002 ; .
Click on X.
Select Yes to save.Select View SQL View
Add this Line in
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
16/22
7-16
Double click on Table2 Query.
Only the record Half Life is displayed.
Double click here
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
17/22
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
18/22
7-18
Database Security
Select File Open
Select Open Open Exclusive.
1) Select File - Open
2) Select
Open-
OpenExclusive
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
19/22
7-19
7.3 Select Tools Security Set Database Password
Select Tools Security
Set Database Password
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
20/22
7-20
Key in the password as 1234.
Verify the password as 1234.
Click OK.
Key in the
password
as 1234
Verify the
password as
1234
Click OK.
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
21/22
7-21
Close the database file by clicking on the X.
Select File - Open.
Select the database file to open it.
It will prompt you for the password.
Enter the password 1234.
Click OK.
Click
OK
-
7/31/2019 MELJUN CORTES Computer Application Chp 6 Ms Access SQL
22/22
Exercise
1) Create a table called Employee with the following fields:
EmpID : NumericName : TextSalary : Currency
Create the following records into this table :
1004 John Lim $20001005 George Tan $25001006 Mary Chan $4000
2) Create a query to shown the employees with salary more than $2000.
3) Create a query to show the employee with EmpID = 1006.
top related