0% found this document useful (0 votes)
35 views

1 - Review of Fundamentals of DBMS

This document provides an overview of database management systems and relational database concepts. It defines key terms, describes the advantages of DBMS, and covers data modeling concepts like entities, attributes, and relationships. It also explains relational database tables, keys, and basic SQL syntax for queries, inserts, updates and deletes.

Uploaded by

nouilhdvior
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

1 - Review of Fundamentals of DBMS

This document provides an overview of database management systems and relational database concepts. It defines key terms, describes the advantages of DBMS, and covers data modeling concepts like entities, attributes, and relationships. It also explains relational database tables, keys, and basic SQL syntax for queries, inserts, updates and deletes.

Uploaded by

nouilhdvior
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

● Define terms.

● Explain the advantages of DBMS.


● Understand the importance of data modeling.
● Identify properties of relations, and different key
fields.
● Understand basic SQL syntax.
• DATABASE: an organized collection of logically related
data.
• DATA: a stored representation of meaningful objects
and events.
• INFORMATION: data processed to increase knowledge
in the person using the data.
• METADATA: data that describes the properties and
context of user data.
Description of the properties or characteristics of the data, including data types,
field sizes, allowable values, and data context.
• Program-data independence
• Planned data redundancy
• Improved data consistency
• Improved data sharing
• Increased application development productivity
• Enforcement of standards
• Improved data quality, accessibility, and responsiveness
• Reduced program maintenance
• Improved decision support
• Entity-relationship Model - a logical representation of
the data for an organization or a business area.

• Entity-relationship diagram or ERD – a graphical


representation of an entity-relationship model.
• Entity – A person, a place, an object, an event, or a
concept in the user environment.

• Entity Instance - A single occurrence of an entity type.

• Attribute – properties or characteristics of an entity or


relationship type.
• A named, two-dimensional table of data.
• Consists of rows (records) and columns (attribute or
field).
• Requirements for a table to qualify as a relation:
• Must have a unique name.
• Every attribute value must be atomic (not multi-valued, not
composite).
• Every row must be unique.
• Attributes in tables must have unique names.
• The order of the columns must be irrelevant.
• The order of the rows must be irrelevant.
• Relations (tables) correspond with entity.
• Rows correspond with entity instances.
• Columns correspond with attributes.

NOTE: The word RELATION (in a relational database) is NOT


the same as the word RELATIONSHIP (in E-R Model).
•Keys are special fields that serve two main purposes:
• Primary keys are unique identifiers of the relation.
This key guarantees that all rows are unique.
• Foreign keys are identifiers that enable a
dependent relation (on the many side of the
relationship) to refer to its parent relation (on the
one side of the relationship).
Primary Key

Foreign Key
Implements 1:N relationship
between customer and order

These are composite primary key


(uniquely identify the order line).
Individually, they are foreign keys.
•Referential Integrity
• Rule states that any foreign key value (on the relation of
many side) MUST match a primary key value in the
relation of the one side.
For Example: Delete Rules
• Restrict: don’t allow deletion of the “parent” side if related rows exist
in the “dependent” side.
• Cascade: automatically deletes “dependent” side rows that
correspond with the “parent” side row to be deleted.
• Set-to-Null: set the foreign key in the dependent side to null if
deleting from the parent side.
• Structured Query Language
• Pronounced “S-Q-L” by some, “sequel” by others.
• Standard for relational database management
systems (RDBMS).
• RDBMS – a DBMS that manages data as a collection of
tables in which all relationships are represented by
common values in related tables.
• Commands used to create, alter, and drop tables, views, and
indexes.
• Used to establish constraints in the database.

•CREATE
• Creates an object (a table, for example) in the database.
•DROP
• Deletes an object in a database, usually irretrievably.
•ALTER
• Modifies the structure of an existing object in various ways.
For example, adding a column in an existing table.
• Commands used to maintain and query a database,
including those for updating, inserting, modifying, and
querying data.
• They may be issued so that a result is returned
immediately following the execution of the
statement.
The acronym CRUD refers to all major functions that need to be
implemented.

Operation SQL Description


Create INSERT INTO Inserts new data into a database.

Read (Retrieve) SELECT Extracts data from a database.

Update UPDATE Updates data in a database.

Delete (Destroy) DELETE Deletes data from a database.


• Comparison operators
• =, <, >, <=, >=, <>
• Logical operators
• AND, OR, NOT
• Special operators
• BETWEEN, IS NULL, LIKE, IN
• Aggregate functions
• COUNT, MIN, MAX, SUM, AVG
• Use one line per column (attribute) definition.
• Use spaces to line up attribute characteristics and
constraints.
• table and attribute names are capitalized:
• Primary key attributes contain both NOT NULL and a
UNIQUE specification.
• RDBMS automatically enforced referential integrity for
foreign keys.
• Command sequence ends with a semicolon.
SYNTAX

CREATE TABLE tablename (


column1 datatype(fieldsize),
column2 datatype,
column3 datatype,
… );
• The INSERT command is used to enter data into the table.
• When entering values, notice that:
• Row contents are entered between parentheses.
• Character and date values are entered between
apostrophes.
• Numerical entries are not enclosed in apostrophes.
• Attribute entries are separated by commas.
• Value is required for each column.
• Use NULL for unknown values.
SYNTAX

INSERT INTO tablename VALUES


(‘value1’, ‘value2’, … valueN);
• The SELECT command is used to list contents of a table.

SYNTAX
SELECT columnlist FROM tablename;
• The columnlist represents one or more attributes, separated by
commas.
• An asterisk (*) can be used as a wildcard character to list ALL
attributes.
• The UPDATE command is used to modify data in a table.

SYNTAX

UPDATE tablename
SET columnname = expression
WHERE conditionlist;
• The DELETE command deletes a table row.

SYNTAX
DELETE FROM tablename
WHERE conditionlist;
• If WHERE condition is not specified, ALL rows from specified
table will be deleted.
• PRIMARY KEY – a key that uniquely identifies each record in
a table and it should not contain NULL values.

SYNTAX
CREATE TABLE tablename (
columnname1 datatype,
…,
PRIMARY KEY(columnname));
• FOREIGN KEY – a key used to link two tables together. It is
a field in one table that refers to the PRIMARY KEY in another
table.

SYNTAX
CREATE TABLE tablename (
columnname1 datatype,
…,
PRIMARY KEY(columnname),
FOREIGN KEY(columnname) REFERENCES
tablename(primary key));

You might also like