This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CSE 136 Lecture 2
Database design steps for the enterprise Logical Design Overview Physical Design Logical design in detail
Conceptual Modeling Model to Schema
Database Security Enterprise Database Environment Continuous Integration DB – build DB
project
Database Design Step
Determine requirements
RequirementAnalysis
Logical Design
Physical Design
Implementation
Model Integrated views
Transform to SQL tablesIf there aremultiple dbdesigners
Normalize
normalize until ithurts
select indexes
Implementation
de-normalize untilit works
De-normalize
Monitor and detect changing requirements
ER Model
Using MS SQL 2008
Logical Design Overview 1
Conceptual data modeling
The data requirements are analyzed and modeled using an ER orUML diagram that includes, for example, semantics for optionalrelationships, ternary relationships, supertypes, and subtypes(categories).
Outcome ofyour analysis
UML diagram
customer orders product
customer served-by salesperson
product sold-by salesperson
Logical Design Overview 2
View Integration
Usually, when the design is large and more than oneperson is involved in requirements analysis, multipleviews of data and relationships result
Multiple Views,but one final
design
Logical Design Overview 3
Tranformation (model to SQL tables)
Based on a categorization of data modeling constructs and a set ofmapping rules, each relationship and its associated entities aretransformed into a set ofDBMS- specific candidate relational tables
Data Definition Language(DDL)
More details later
Logical Design Overview 4
Normalization
Functional dependencies (FDs) are derived from theconceptual data model diagram and the semantics ofdata relationships in the requirements analysis.
job-level 10employees are
allowed 30 days ofvacation days per
year
10 3010
EntityRelationships
Physical Design
Physical Design
involves the selection of indexes (access methods),partitioning, and clustering of data
Indexing
performance
index is based on binary-tree
Clustering
fail-over for reliability
Partitioning
different disks for performance
Materialized viewers
caching remote data
Denormalization
faster retrieval - combine normalized tables into larger tables
Conceptual Modeling - generalization
If there is a generalization hierarchy among entities, then put theidentifier and generic descriptors in the super-type entity and putthe same identifier and specific descriptors in the subtype entities
grad undergrad international professional
phd/ma/ms 1st, 2nd.. nationality company
Conceptual Modeling - relationships connectivity
The connectivity of a relationship describes a constraint on theconnection of the associated entity occurrences in the relationship
1 manager
many employees
Isaac C.Doug N.Tim L.Trevor S.
IRADmilitarymaps
Existence of an entity occurrence in a relationship is defined as eithermandatory or optional
dept is optional
Office is required
Model to SQL schema
Data Definition Language Why use data definition language?
Multiple database designers modifying DDL Version Control Build the database script from scratch (for unit
testing) Examples
Create table Alter table Drop table Create/drop view
Model to SQL 1
One-to-one, both entities mandatory
1-to-1relationship
Deleting a report also deletes abbreviationentry with the same report_no
update report.report_no will also updatethe abbreviation.report_no
Model to SQL 2
Many-to-many, both entities optional
combination keys
Enrollment example
Step 1. CreateStudent table
Student
student_idfirst_namelast_name
etc
"A0123456789""Becky""Smith"
Step 2. CreateCourse table
Course
course_idcourse_number
course_titledepartment_id
100001"CSE 132A"
"Database Systems I"20001
Step 3. CreateCourse_ScheduleTable
Course_Schedule
schedule_idquarter
yearcourse_id
section_number
course_id
200015"fall"2011
100001"A00"
Step 4. CreateEnrollment table
Enrollment
student_idschedule_id
"A0123456789"200015
student_id
schedule_id
Enrollment table contains all the students enrollment
Commonly known as a join-table (combo-key; many-to-many)
Enrollment example
Student
student_idfirst_namelast_name
etc
Course
course_idcourse_number
course_titledepartment_id
Course_Schedule
schedule_idquarter
yearcourse_id
section_number
Enrollment
student_idschedule_id
student_id
course_id
schedule_id
Which table should "grade" column be added?
grade
Which table should "instructor" column be added to?
Instructor_id
Instructor
instructor_idfirst_namelast_name
titledegree
instructor_id
What about pre-requisites?
prereq_course_id
How about 100,both 140 & 141 are
pre-req for 136?
Pre_ req
course_idprereq_course_id
course_idcourse_id
---- -----136 100136 140136 141
SQL Security
Secure Configuration Authentication
login/password Authorization
What you can access after you login
Data Encryption Protecting sensitive
data from internal and external hackers
SQL Security - Secure Configuration
Physically secure the server behind firewall Enable only the minimum network protocols
required Use Windows Update to apply patches Surface Area Configuration - turn off default
SQL features CLR Integration Database mirroring Debugging Service broker E-Mail functions
SQL Security - Authentication Use simple connection strings containing user names
and passwords during development Create SQL user for test-user (shows password in web.config &
app.config) Use windows authentication in production with more
security SQL 2008 uses encryption of the channel by default
(avoid data sniffing) Windows Group Policy
password complexity password history password age expiration lockout after failed attempts
SQL Security - Authorization
After authentication, what can you access?
Depends on your roles (owner, admin, operator, reader, etc)
Principal Any individual, group, or process that can
request access to a protected resource Securable
object that you can secured by granting or denying of permissions
SQL Security - Principal
Windows-level principals Domain, local, group
SQL Server-level principals SQL login login mapped to a windows login login mapped to a certificate login mapped to a asymmetric key
Database-level principals Database user user mapped to SQL server login user mapped to windows login, certificate, asymmetric key Database role Application role etc...