Database - 1 - 2

  • pptx
  • 09.05.2020
Публикация на сайте для учителей

Публикация педагогических разработок

Бесплатное участие. Свидетельство автора сразу.
Мгновенные 10 документов в портфолио.

Иконка файла материала Database - 1 - 2.pptx

Database

Learning Objectives

11.4.1.1 -describe relational databases and their purpose
11.4.1.4-define data types when creating a database
11.4.1.2-use the terms attribute, object, index, record, table and tuple to describe databases
11.4.1.3-explain the difference between primary composite and foreign key


Group Work (5 Min) Real-life examples of databases:

HOW might the following use a database? For each one list what data they need to store.
Police
Restaurant
Library
Airlines
Hotel
(5 Min to review)

What is a Database?
A database is any collection of related data.
What is a Database Management System?
A database management system (DBMS) is a collection of programs that enables users to create and maintain a database.

What Does a DBMS Do?

Database management systems provide several functions in addition to simple file management:
allow concurrency
control security
maintain data integrity
provide for backup and recovery
control redundancy
provide non-procedural query language
perform automatic query optimization

Who Interacts with a DBMS?

Many different individuals are involved with a
database management system over its life:
systems analysts
database designers
database administrators
application developers
users

RDBMS

RDBMS stands for Relational Database Management System. A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
Example
MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access

Database

Database software includes off-the-shelf software such as 
Microsoft Access
 Libre Office Base
 Oracle
Microsoft SQL Server
 MySQL 

MySql DataType

Data Type

Description

Storage

Int

-2147483648 to 2147483647 normal.
0 to 4294967295 UNSIGNED*.

4 bytes

Float

A small number with a floating decimal point.

Double

A large number with a floating decimal point.

8 bytes

DECIMAL[Length, Decimals]

A DOUBLE stored as a string, allowing for a fixed decimal point.

Length + 1 or Length + 2 bytes

Char(length)

A fixed-length field from 0 to 255 characters long

Length bytes

Varchar(length)

String length + 1 bytes

Date

In the format of YYYY-MM-DD.

3 bytes

Datetime

In the format of YYYY-MM-DD HH:MM:SS.

8 bytes

Time

In the format of HH:MM:SS

3 bytes

Explore shopping websites : www.amazon.com (5 Min)

1. List the fields that the shopping website might store
2. Mention the types of data

Learning Objective

11.4.1.2-use the terms attribute, object, index, record, table and tuple to describe databases

Table

The table is a collection of related data entries and it consists of columns and rows. Following is the example of a CUSTOMERS table:

Field/column
A field/ column in a table that is designed to maintain specific information about every record in the table.
Record / row
A record, also called a row of data, is each individual entry that exists in a table.

In relational database theory, a relation, as originally defined by E. F. Codd, is a set of tuples
Tuple a set of attribute values (a row in a table)
Attribute is a property or characteristic of an entity (a named column in a table)

SQL

SQL stands for Structured Query Language. SQL is a database computer language designed for the retrieval and management of data in relational database.
SQL commands are divided into four subgroups, DDL, DML, DCL, and TCL.

DDL-Data Definition Language
DML-Data Manipulation Language
DCL-Data Control Language
TCL-Transaction Control Language

Data description language (DDL) is for defining data structures, especially database schemas.

CREATE - to create a database and its objects like (table, index, views, store procedure, function, and triggers)

ALTER - alters the structure of the existing database

DROP - delete objects from the database

TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed

COMMENT - add comments to the data dictionary

RENAME - rename an object

CREATE

SQL > CREATE TABLE CUSTOMERS
( CUSTOMER_ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
City CHAR (25));