SQL FinalReview Updated
SQL FinalReview Updated
User Mgmt
Tuning Auditing
Data DR -
Mgmt Backup
DR -
Security
Recovery
Archiving
SQL Server Administrator’s Duties (Defined)
Installation, Administration and Maintenance of SQL Server Instances. (Installing SQL Server)
Setup Test, Dev, Staging and Production Environments. (Installing SQL Server)
Create Users and assign permissions based on the level of database access the user would need. (Security)
Create Linked Servers to SQL Servers and other databases such as Oracle, Access, Informix etc. (Security and
General Administration)
Design database Backup and Restoration Strategy. (Database Backups and SQL Server Agent)
Once created the database Backups, monitor those backups are being performed regularly. (SQL Server Agent)
SQL Server Administrator’s Duties (Defined)
From time to time recover the databases to a specific point of time, as per the requests. (Database Backups and
Recovery)
Setup High-Availability as part Disaster Recovery Strategy for the Databases. (Failover Clustering, Database
Mirroring, Log Shipping and Replication)
Troubleshoot various problems that arise in a day-to-day work and fix the issues. (Monitoring SQL Server Error
Logs and checking your email alert (if there is one configured))
Monitoring and Performance Tuning; Physical Server Level, Database level (Database settings and options) and
query tuning. (Creating and maintaining those Indexes, not performing database shrinking, memory settings,
monitoring CPU usage and Disk I/O activity etc)
Documenting major changes to the SQL Servers. (General)
Apply Service Packs. (General)
Relational Database Management System
(RDBMS)
RDBMS stands for Relational Database Management System. RDBMS data is structured in database tables, fields
and records. Each RDBMS table consists of database table rows. Each database table row consists of one or more
database table fields.
RDBMS store the data into collection of tables, which might be related by common fields (database table columns).
RDBMS also provide relational operators to manipulate the data stored into the database tables. Most RDBMS use
SQL as database query language.
Edgar Codd introduced the relational database model. Many modern DBMS do not conform to the Codd’s definition
of a RDBMS, but nonetheless they are still considered to be RDBMS.
The most popular RDBMS are MS SQL Server, DB2, Oracle and MySQL.
RDBMS Objects - Tables
You already know that the table is the central RDBMS object. In a perfect world you would never have to
change anything in a table's structure after it was created. In real life though you need to modify table
definitions quite often. Changing business rules are usually the main reason; incorrect initial design is also
not uncommon, especially in test environments. The whole idea behind the ALTER TABLE statement is to
make the table definition changes as fast and as painless as possible. The DROP TABLE statement is used
to remove a table (both its data and definition) from the database.
Planning Your Database
Designing a database requires an understanding of both the business functions you want to model and the
database concepts and features used to represent those business functions.
It is important to accurately design a database to model the business because it can be time consuming to
change the design of a database significantly once implemented. A well-designed database also performs
better. When designing a database, consider: The purpose of the database and how it affects the design.
Create a database plan to fit your purpose.
Database normalization rules that prevent mistakes in the database design
Protection of your data integrity
Security requirements of the database and user permissions
Performance needs of the application
Software Development Life Cycle (SDLC)
Software life cycle models describe phases of the software cycle and the order in which those phases are
executed. Each phase produces deliverables required by the next phase in the life cycle. Requirements are
translated into design. Code is produced according to the design which is called development phase. After
coding and development the testing verifies the deliverable of the implementation phase against
requirements.
There are following six phases in every Software Development Life Cycle model:
Requirement gathering and analysis
Design
Implementation or coding
Testing
Deployment - Evolution
Maintenance
Software Development Life Cycle
SCF Administrative Services – Software Development Lifecycle (SLDC)
1 – Project Initiation
• Banner Project Request Form
6 – Project Completion
Filled out and submitted
• User approval for Production
• Initial Requirements gathered
• Request submitted to
Step 7: DBA Step 1: • Data Custodian Meetings
Change Management
Deploy to Project established
Meeting (Wednesdays)
Production Planning • Resources Estimated
• Coordination of push to
Production
2 – Project Approval
Step 6: Final • Present Project to BUG
Step 2: Present
Approval • Further define requirements
Project to BUG
Process based on BUG feedback
Step 3:
Step 5: 3 – Project Documentation
Project
Testing • Helpdesk Ticket Open with
Specifications
Initial Requirements (Project
5 – Project Testing
Classification)
• Deployment Instructions Step 4:
Development & • Requirements completely
• Deployed to BIWK for Coding defined
testing and user feedback • Software Design Specifications
• Requirements Traceability
Matrix
Requirements Design Development Test Deployment
SDLC – Database Design
Normalization
The logical design of the database, including the tables and the relationships between them, is the core of an optimized relational
database. A good logical database design can lay the foundation for optimal database and application performance. A poor logical
database design can impair the performance of the entire system.
Normalizing a logical database design involves using formal methods to separate the data into multiple, related tables. A greater number
of narrow tables (with fewer columns) is characteristic of a normalized database. A few wide tables (with more columns) are
characteristics of an non-normalized database.
In relational-database design theory, normalization rules identify certain attributes that must be present or absent in a well-designed
database. A complete discussion of normalization rules goes well beyond the scope of this topic. However, there are a few rules that can
help you achieve a sound database design: A table should have a numeric or uniqueidentifier (GUID) primary key
A table should store only data for a single type of entity (all fields should relate directly to the key) For example: Avoid storing information about a
student and his/her test scores in the same table
A table should avoid nullable columns
A table should use default values where appropriate
A table should not have repeating values or columns For example: TEST_SCORE_1, TEST_SCORE_2 and so on
As normalization increases, so do the number and complexity of joins required to retrieve data. Too many complex relational joins
between too many tables can hinder performance. Reasonable normalization often includes few regularly executed queries that use joins
involving more than four tables.
Data Integrity
Enforcing data integrity ensures the quality of the data in the database. One of the more common forms of
data integrity is referential integrity.
Referential integrity preserves the defined relationships between tables when records are entered or deleted.
In Microsoft SQL Server, referential integrity is based on relationships between foreign keys and primary
keys or between foreign keys and unique keys. Referential integrity ensures that key values are consistent
across tables. Such consistency requires that there be no references to nonexistent values and that if a key
value changes, all references to it change consistently throughout the database.
Data Security
One of the functions of a database is to protect the data by preventing certain users from seeing or changing
highly sensitive data and preventing all users from making costly mistakes. For this reason, each application
will use a separate user with specific permissions to only the data needed to provide a successful
implementation.
Database Performance
When you design a database, you must ensure that the database performs all the important functions correctly and
quickly. Some performance issues can be resolved after the database is in production, but other performance issues
may be the result of a poor database design and can be addressed only by changing the structure and design of the
database.
When you design and implement a database, you should identify the large tables in the database and the more
complex processes that the database will perform, and give special consideration to performance when designing
these tables. Also consider the effect on performance of increasing the number of users who can access the database.
In conjunction with correct database design, correct use of indexes is important for achieving good performance.
Indexes in databases are similar to indexes in books. In a book, an index allows you to find information quickly
without reading the entire book. In a database, an index allows the database program to find data in a table without
scanning the entire table. An index in a book is a list of words with the page numbers that contain each word. An
index in a database is a list of values in a table with the storage locations of rows in the table that contain each value.
Indexes can be created on either a single column or a combination of columns in a table. An index contains an entry
with one or more columns (the search key) from each row in a table.
SQL – Querying the Database
SQL – Querying the Database
Example – Employee Table