Download The essence of data normalization is to spit the data into several

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Data model wikipedia , lookup

SQL wikipedia , lookup

Data analysis wikipedia , lookup

Expense and cost recovery system (ECRS) wikipedia , lookup

Information privacy law wikipedia , lookup

Concurrency control wikipedia , lookup

SAP IQ wikipedia , lookup

Versant Object Database wikipedia , lookup

Open data in the United Kingdom wikipedia , lookup

Database wikipedia , lookup

Business intelligence wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Relational algebra wikipedia , lookup

Clusterpoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Data vault modeling wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Quiz
Part 1,
1.
2.
3.
4.
5.
6.
The goal of any information system is to add value for the user.
The process of determining the proper tables for a database is called Organizations.
The essence of data normalization is to spit the data into several filed.
Primary key is a column or set of columns that identifies particular column.
A primary key can point to more than one object.
One draw back of the class diagram that they can become large& hard to fit all information
on one page.
7. Data engine responsible for sorting, retrieving and update the data.
8. One advantage of designing database table carefully is to ensure data consistency.
9. Primary key should be the smallest set of columns needed to form a unique identifier.
10. A model is a simplified abstraction of real-word system.
11. Primary key value can never be null.
12. The goal of a relational DBMS is to make it easy to store and retrieve the data you need.
13. With the IN operator , the values in the list must be of the same data type (domain) as the
variable being tested.
14. The Outer Join describes what should happen when values in one table do not exit in the
second table
15. surrogate key is useful when there is some uncertainty with the business key.
Most organizations perform Feasibility study , they interesting in evaluating befits in:
1.
2.
3.
4.
5.
Reduction of costs.
Increase in sales or revenue.
Log term benefits (competitive advantage).
1&2
1,2 & 3
A Many-to-Many relationship from an ER diagram can be represented in the relational
model by a:
1. A single attribute
2. Domain
3. Primary key
4. Relation with two foreign key
5. all of the above
Tools that enable you to combine the various features into a single application are called:
1. Application synthesizers
2. Application blenders
3. Application recombinants
4. Application generators
5. non of the above
The functional dependency A -> B for relation schema R(A,B,C,D) implies that
1. No two tuples in R can have the same value for attribute B
2. Any two tuples in R that have the same value for A must have the same value for B
3. Any two tuples in R that have the same value for B must have the same value for A
1
4. No two tuples in R can have the same value for attribute A
Which of the following is FALSE about the primary key.
1.
2.
3.
4.
5.
The primary key must uniquely identify a record.
The primary may consist of more than one field.
The primary key should not be null.
The primary key may be numeric or string data.
The primary key may not also be a foreign key.
A Domain is _______
1. The same as a field.
2. The allowable values a column (or attribute) can have.
3. A link to another table.
4. A derived class.
5. A always a 1 - 1 relationship.
The difference between composition and aggregation (collection):
1. Composition can exit only for one – one relation.
2. Composition can exit only for one – many relation.
3. Composition can exit only for many – many relation.
4. Aggregation can exit only for one – many relation.
5. Aggregation can exit only for many – many relation.
The Performance of your application depend on:
1. Normalization design
2. Hardware,
3. Database Management System
4. 1&2
5. All above
Data normalization is the process of defining table properly to:
1. Provide flexibility.
2. Minimize redundancy.
3. Ensure integrity.
4. Provide faster transaction.
5. 2 & 3.
6. All of the above.
You will need concatenated keys when the table contains.
1. One to one relation.
2. One to many relation.
3. Many to many relation.
4. 1 & 2.
5. 2 & 3.
The useful diagram for recording business processes and events is:
1. Class diagram
2. Process diagram
2
3. Collaboration diagram
4. Follow chart diagram
The main task of a query languages are:
1. Define the DB.
2. Change the data.
3. Change & retrieve the data
4. Retriever the information.
5. 1 &3
6. 1&4
The drawback of the auto-number data type:
1. Some time difficult to obtain the new values that was generated when a row is inserted.
2. Must ensure that all user and developer use the proper number generation command.
3. They are not related to any business data.
4. Non of the above
5. All of the above
First Normal Form is designed to:
1. Ensure that there are no repeating fields in a table(i.e. the fields are atomic)
2. ensure that there are no duplicate key fields in a table
3. ensure that all of the data in a RDBMS is represented in one data table
4. ensure that data is held accurately
1. Match the following.
SELECT
FROM
WHERE
ORDER BY
AS
Determines which records are to be retrieved from a table.
Determines how retrieved records are to be sorted
Used to give a field name to a computation
Determines what fields are included in the query output.
Specifies the tables from which data is to be extracted.
.
Part 3
For each of the following tables determine if each contains a violation of a normal
form(DKNF). If so, state which normal form and identify the violation by underlining the
fields causing the violation.
Employ(EmpID, Name, DOB, Cell phone)
Business rules: An employ may have mare than one cell phone
.
.
.
3
.
Customer(CusID, Name, City , Address, phone, Cell-phone)
Business rules: A customer may have many address and within the address he have many
phone.
.
.
.
.
Student(SID, Name, Gender, Address, Major, Advisor)
Business rules: A student can have many advisors, but only one for each major.
.
.
.
Student(SID, Name, Course, Tutor)
Tutor(TuID, Name, Office, Course)
Business rules: A student can have many tutors, but only one for each course. Tutors can teach
more than course.
.
Part 4, Give an SQL query to retrieve the following:
1.
List all animalID and their names?
.
.
2.
List all Cats?
.
.
3.
List all Cats with white in their color born after 1/1/02.?
4
.
.
.
4.
List all merchandise for cats with a list price greater than $10?
.
.
.
5.
List all Dogs who are female and registered or who were born before 1/1/02 and have
white in their color?
.
.
.
6.
What is the average sale price of all animals?
.
.
7.
which cat is less price and which is high price?
.
.
8.
What is the total cost we paid for all animals?
.
.
9.
How many cats are in the animal list?
.
.
.
10.
How many cats, dogs and fishes are in the animal list?
5
.
.
.
11.
Count the number of animals in each category.
.
.
.
12.
Count the number of animals in each category, but list only the category if there are less
than 50 of these animal?.
.
.
.
.
13.
List the first name and phone of every customer who bought any products between 1/1/02
and 1/1/04.( Do not list any duplicate name).
.
.
.
.
.
14.
List the last name and phone of anyone who bought a registered white cat between 1/1/02
and 12/31/02.
.
.
.
.
15.
Which employee has sold the most items?
6
.
.
.
.
16.
which product is our best seller? Best is measured in
1- Revenue (price*quantity).
2- quantity sold.
1.
2.
.
.
.
.
17.
did the store sell more female or male animals ?
.
.
18.
did the store sell more females or males animal in march?
.
.
.
19.
d A programmer keeps separate database tables for Spring and Summer activities for a
club. The tables are called SpringAc and SummerAc and have the exact same format. Later
she decides to merge the data in the two tables into one table called Activities. Give an
SQL query to accomplish this.
.
.
7
Part 5
Consider the tables in the HighSchool database given below.
Table DISCIPLINES contains all disciplines taught.
English, Math, History and Physics are examples of disciplines.
Table COURSES identifies what courses may be taught in the school system.
Creative Writing, Algebra, World History and Classical Physics are examples of courses.
Note that each course belongs to a discipline. For ex. the Algebra course belongs to the Math
discipline.
Table TEACHERS contains all teachers at Morris Co. High School.
Table CERTIFICATIONS specifies the disciplines in which teachers are certified to teach.
For example teacher Smith, Joe is certified to teach any course in the Math discipline.
Table CLASSES specifies what teachers are teaching what courses.
For example, Smith, Joe is teaching Algebra, sections B and C, this semester.
1. Identify the primary keys and Composite key (if any) for each of the tables in HighSchool.
2. Identify all foreign keys and draw a relationship diagram for the tables in HighSchool. All
relationships must be identified as 1-M, M-1, 1-1, 1-0/1 or M-M.
3. A) Business rule S1 states that a section identifier for a class must be a single uppercase
letter. How should this rule be enforced by the database?
4. B) Business rule CD1 states that each course in COURSES must come from a valid
discipline. How should this rule be enforced by the database?
5. Business rule TCC1 states that a teacher must be certified to teach any course the teacher is
assigned in CLASSES. How should this rule be enforced by the database?
6. If the certification rules are changed so that teachers are certified in courses rather than in
disciplines then the CERTIFICATIONS table will be changed so that it specifies the
courses (rather than the disciplines) a teacher is certified in. In this case how should the rule
that states that "a teacher must be certified to teach any course the teacher is assigned in
CLASSES" be enforced by the database?
7. Business rule TC9 states that a teacher may teach no more than 5 courses in a semester.
How should this rule be enforced by the database?
8. Given the HighSchool database tables as originally defined and the new condition for
CERTIFICATIONS as given above and business rules S1, CD1 and TCC1 what is the
8
highest normal form to which the database conforms? ____
A) First
B) Second
C) Third
D) Domain Key
E) It does not conform to any of the above.
9. If business rule TC9 is required to be enforced then what is the highest normal form to
which the database conforms? ____
A) First
B) Second
C) Third
D) Domain Key
E) It still does not conform to any of the above.
10. You are the owner of a small computer consulting firm called VAConsult. You have 10
employees/associates. Seven of your employees are consultants. One is a secretary, one is
an accountant and one is a general office worker. You have many clients. Your consultants
work on projects for clients. When a project is established with a client one or more
consultants are assigned to that project. Your consultants generate transactions by meeting
with clients or doing research for clients or talking to clients on the phone. Only
consultants assigned to a project should bill time on that project.
a)Create a database that supports the business defined above.
b)Identify all entities/classes/tables, their primary keys and other attributes.
c) Identify all foreign keys and relationships between tables and draw a relationship diagram
for the database.
9