Beruflich Dokumente
Kultur Dokumente
Objectives
2
To discuss:
Database
How
Basics
to
execute
SQL queries
SQL SELECT Statement
Data-Related
Objects
Database Basics
4
Database Basics
In
3/20/2016
Primary Key
5
but
Microsoft
i.e.
Generally,
Avoid spaces in your column names as it causes SQL queries to be more complicated.
3/20/2016
Recommendations When
Choosing Column Types
Linked Tables
10
2.
the same department name appears many times within the Employee
table, leading to wasted storage space.
someone typing in employee data might easily misspell a department
name.
3.
s/he would require less time to input a numeric department ID, and there
would be less chance of a typing error.
One-To-Many Relationship
12
foreign key
3/20/2016
13
SELECT column-list
FROM table
SELECT Example
16
SELECT *
FROM SalesStaff
3/20/2016
Calculated Columns
18
SELECT
employeeId,
hoursWorked
*
hourlyRate AS payAmount FROM PayRoll
ORDER BY
19
Examples:
ascending
or descending
ORDER BY Last_Name
ORDER BY Last_Name DESC
ORDER BY Last_Name, First_Name
ORDER BY Last_Name ASC, Salary DESC
3/20/2016
Selecting Rows
Relational Operators
21
optional
Example:
WHERE
WHERE
WHERE
WHERE
Full_Time
Full_Time
Full_Time
Full_Time
= 1
= 'True'
= 0
<> 'False'
3/20/2016
LIKE Operator
25
LIKE Operator
26
E.g.
LIKE Operator
27
3/20/2016
Examples
29
30
OR
32
WHERE
(Hire_Date
NOT
BETWEEN
'1/1/2008' AND '12/31/2010')
The following expression matches rows in which the
last name does not begin with the letter A:
WHERE (Last_Name NOT LIKE 'A%')
3/20/2016
Data-Related Objects
34
Usually
Data-Related Objects
35
Data source
Data-Related Objects
36
TableAdapter
Pulls
DataSet
In-memory
Virtual
An
3/20/2016
Data-Related Objects
37
Data-Related Objects
38
DataTable
Table
inside a DataSet
Holds data generated by a TableAdapters
SELECT query.
Has a Rows collection that corresponds to
database table rows.
You can loop through the Rows collection and
inspect or modify individual column values
within each row.
Optional.
Provides
Conceptual View
39
BindingSource
Key Terms
40
auto-generated field
BindingSource object
components
compound primary key
database
database schema
data binding
data-bound control
DataGridView control
DataSet
DataTable
data source
DataSource property
DisplayMember property
foreign key
identity field
LIKE operator
one-to-many relationship
ORDER BY clause
primary key
query parameter
relational database model
SELECT statement
Structured Query Language (SQL)
TableAdapter
WHERE clause
wildcard symbol
xcopy deployment
10