Lecture 1 - Introduction Sqldatabase
Lecture 1 - Introduction Sqldatabase
Delimiter Character
Repeated data (redundancy)
Hierarchical Databases
• Hierarchical databases are organized in a tree-like
structure
– Parent table can have many child tables
– No child table can have more than one parent
– They are connected to one another through links
• E.g.,
– Directories/Sub directories/Files hierarchies in OS
• Disadvantages
– It does present the same problems of redundancy, data
integrity, and comparability of data
Hierarchical Databases
Parent
Children
Relational Databases
• In relational model, data is organized into tables
– Even the info about the tables is stored in tables
• Relationship among tables
– Defined by repeating column(s) from one in another
table
– These repeating columns are called “keys”
• This solved many problems
– One of those is data redundancy
Keys?
• In RDBs, each table usually has one (or more)
column(s) designated as a primary key
• A key uniquely identifies each row in a table
– Giving one of its values, you can find exactly one
row in the table
• This key becomes a foreign key when it is
repeated in another table
– To create relationship between the tables
Relational Databases
Primary keys
• Current system
– Paper based records are taken back to the office
every 2 weeks and typed into Excel
• Opportunity
– A DB is proposed to replace this
DBMS
• A DBMS is a system for managing DBs
• It supports
– Creating/Manipulating DBs
– Maintaining DB (backing up/recovering, etc.)
– Security for the DB
– Etc.
Some famous RDBMSs
SQL
• Allows users to access data in relational database
management systems
• Allows users to describe data
• Allows to embed within other languages SQL modules,
libraries & pre-compilers
• Allows users to create and drop DBs and tables
• Allows users to create view, stored procedure, functions
in a database
• Allows users to set permission on tables, procedures,
and views
https://www.tutorialspoint.com/sql/sql-overview.htm
Practical Tutorial 2
• Use SQL Code to create the same database
that you’ve made in Practical Tutorial 1
How do you get the requirements?
• One of the ways is to prepare an interview, in
which you can ask about
– What things the client is doing/recording?
– What business constraints are required?
– What reports are expected?
– Etc.,
Identifying the big topics
• After the interview, first thing to do is to identify
the big topic
– What the database is about?
– What are the major components going to be?
– What does it include?
• Specifically, list the entities of the DB and specify
the attributes inside them
• How to find these?
– One way is to look at the nouns in your document
Entities and Attributes?
• An entity is something that the database is
concerned with
– Data is stored about this
– It may have relationship with other entities
• Attributes define entities
– The entity student has attributes like Id, name,
DoB, email, etc.
Activity: Finding the entities
• Find the entities for this “tutoring” scenario
Activity Result
• Tutors
• Students
• Schedules
• Courses
• Requests
• Sessions
Getting the scope
• Statement of work
– Is a short statement of one or more paragraphs
– Says in clear, general terms what project will do
– It’s a more complete statement about the objectives and
timeline of the project
• Why?
– We are making a DB for a client not just ourselves
– Not get trapped by preconceived notions
– Need to get as clear as possible about what DB is
intended to do
Elements of Statement of Work
• History: Reasons for the project
– Problem of the current system or
– Opportunity to provide new services
• Scope: Requirements and expectations
– States high level requirements
– It doesn’t go into details about how things are done
– May include some general constraints (time, budgets)
• Objectives: Things intended to achieve
– What database is supposed to achieve
– I.e., why the client wants the DB
• Tasks and deliverables:
– Project is broken into discrete tasks with time and deliverables
Activity (Homework)
• Study statement of the work for the “tutoring”
scenario in the textbook of this course
Documenting a DB
• It’s important
– Imagine if you taken over a DB from another
– How do you work with it if you don’t have a doc
• How to document a DB? There are two main
aspects to describe:
– Process by which the DB was developed
– The structure of the DB
Documenting DB
• Describe processes by which DB will be
developed
– The first one is the Statement of the work
– In the future, you will learn more documents
• Structures of the DB, describes “Data
dictionary”:
– Tables
– Columns and their data types
– Relationships among tables
Things we have done
• Identified situation in which a DB could prove
valuable
• Reviewed briefly the history of DBs
• Identified some components of RDBMS
– e.g., entities, attributes and key fields
• Using interview
– To gather general information about a DB
• Developing Statement of work for a DB
Activity
References
• Cogner, S., 2012. Hands-on Database: An
Introduction to Database Design and
Development. Prentice Hall.