It Faq
It Faq
It Faq
RealDB > RealDB > column(row>50(Table))1 Error: school kid error :]. There is no use for this crap in real life. RealDB >
Equivalent to SELECT column FROM Table WHERE row > 50, see the book on page 217.
Contents
1 Introduction To Databases 1.1 Dene DBMS. . . . . . . . . . . . . . 1.2 List some database applications. . . . . 1.3 What are the drawbacks of le system? 1.4 What are the levels of abstraction? . . . 1.5 Dene database schema. . . . . . . . . 1.6 Dene an instance. . . . . . . . . . . . 1.7 Dene physical data independence. . . . 1.8 Dene data models. . . . . . . . . . . . 1.9 List some data models. . . . . . . . . . 1.10 Dene DML. . . . . . . . . . . . . . . 1.11 What are the classes of DML? . . . . . 1.12 Dene DDL. . . . . . . . . . . . . . . 1.13 What are integrity constraints? . . . . . 1.14 Dene database design. . . . . . . . . . 1.15 Dene normalization. . . . . . . . . . . 5 5 5 5 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 10 10 10 10 10
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
Introduction to Relational Model 2.1 What is a relation, an attribute and a tuple2 ? 2.2 What are relational databases? . . . . . . . 2.3 Dene the domain of the attribute. . . . . . 2.4 Dene atomic attribute. . . . . . . . . . . . 2.5 Let R = (A1 , A2 , A3 ), which is the relation tribute? . . . . . . . . . . . . . . . . . . . 2.6 What is the superkey? . . . . . . . . . . . . 2.7 What is the candidate key? . . . . . . . . . 2.8 What is the primary key? . . . . . . . . . . 2.9 What a foreign key means? . . . . . . . . .
2
. . . . . . . . . . . . . . . . . . . . . . . . and which . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . is the at. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 3
CONTENTS Introduction to SQL 3.1 What does SQL stand for? . . . . . . . . . . . . . . . . . . . . . 3.2 List some SQL DDL operations. . . . . . . . . . . . . . . . . . . 3.3 List some SQL DML operations. . . . . . . . . . . . . . . . . . . 11 11 11 11
DBMS stands for database management system. It contains information about a particular enterprise, collection of interrelated data, set of programs to manage the data and an environment that is both convenient and efcient to use.
1.2
Databases are used in banking to manage customer information and their accounts. They are also used in universities to manage students registration and grades. Also, they are used by human resources to keep employee records and salaries. Databases touch all aspects of our lives these days.
1.3
Databases were built on top of le system which has some drawbacks such as: Difculty in accessing the data, need new program to preform new tasks. Data isolation, multiple les with multiple formats. integrity problems, integrity constraints are hidden in program code and its hard to add new change existing once. 5
1.4
There are there levels of abstraction in databases, Figure 1.1 1. Physical level, describes how a record is stored. 2. Logical level, describes data stored in database and the relationships among the data. 3. View level, application programs that hide the details of data types. View also can be used to hide information like for security purposes.
1.5
It is the logical structure of the database. Example, the database consists information about students and their classes and the relationship between them. Database schema analogous to type information of a variable in a program. it has to types: 1. Physical schema, database design at the physical level. 2. Logical schema, database design at the logical level.
1.6
Dene an instance.
The actual content of the database at a particular point in time, similar to the values of variables.
1.7
Its the ability to modify the physical schema without changing the logical schema.
1.8
Collection of tools for describing: data. data relationships. data semantics. data constraints.
1.9
Relational model. Entity-Relationship data model. Object-based data models. Semistructured data model. And there are some older models such as network and hierarchical models.
1.10
Dene DML.
DML stands for Data Manipulation Language, it is a language for accessing and manipulating the data organized by the appropriate data model, also known as data query language.
1.11
1. Procedural, user species what data is required and how to get those data. 2. Declarative (non-procedural), user species what data is required without specifying how to get those data. SQL is the most used non-procedural language 1 .
1.12
Dene DDL.
DDL stands for Data Denition Language, it species notation for dening the database schema. The DDL compiler generates a set of table templates stored in a data dictionary that contains metadata (data about the data) such as: Database schema. Integrity constraints. Authorization.
1.13
Integrity constraints ensure that changes made to the database by authorized users do not result in a loss of data consistency. For example an instructor name cannot be NULL2 .
1.14
The process of designing the general structure of the database: Logical Design, Deciding on the database schema. Physical Design, Deciding on the physical layout of the database.
1.15
1 2
Dene normalization.
relation, a term refers to a column of a table. attribute, a term refers to a column of a table. tuple, a term refers to a row.
2.2
A relational database consists of a collection of attributes, or tables, each has a unique name.
2.3
The set of allowed values for each attribute is called the domain of the attribute.
2.4
10
2.5
Let R = (A1, A2, A3), which is the relation and which is the attribute?
2.6
A superkey is a set of one or more attributes that allow us to identify uniquely a tuple in the relation.
2.7
2.8
The selected key of the candidate key is called the primary key.
2.9
3.2
3.3
11