In: Computer Science
And PAYMENT (PaymentNumber, MemberNumber, PaymentDate, PaymentAmount)
what are the primary keys of each table? Do you think that any of these primary keys could be surrogate keys? Are any of these keys composite keys? Explain how the two tables are related. Which table contains the foreign key, and what it is the foreign key?
1. What is a database?
Data:
Data is a collection of a distinct small unit of information. It can be used in a variety of forms like numbers, text, media, bytes, etc. It can be stored in pieces of paper or electronic memory, etc.
Database:
A database is an organized collection of data or structured information, which is also called as structured data and it can be typically stored and accessed electronically from a computer system. A database is usually controlled by a database management system (DBMS).
Purpose Of Database:
Uses Of Database:
Database is an essential part of our life. There are several places where we need to interact with the database.
By using the database we can easily store and manage a large amount of data at one place so fetching of the data can be easy.
for example database plays major role in the places like bank, in the railway station, in school, in a grocery store, etc.
Types Of Database:
Among these Relational Database is the most commonly used Database.
2. Why do today’s Internet Web applications and smartphone apps need databases?
Web applications and smartphone apps need databases to store, access and modify the data.
Let us consider the tables
2.PAYMENT (PaymentNumber, MemberNumber, PaymentDate, PaymentAmount)
3. What are the primary keys of each table? Do you think that any of these primary keys could be surrogate keys?
Primary Key:
A primary key is a minimal set of attributes in a table that uniquely identifies tuples in that table.A table can have only one primary key and must contain UNIQUE values, and cannot contain NULL values.
The primary key of MEMBER table is MemberNumber, and
The primary key of PAYMENT table is PaymentNumber.
A Surrogate key is any column or set of columns that can be declared as the primary key.Moreover, the common type of surrogate key is an incrementing integer, such as an auto_increment column in MySQL, or a sequence in Oracle, or an identity column in SQL Server. As we observe both MemberNumber and PaymentNumber are autoincrement columns in a table.
Hence, both of these Primary keys i.e, MemberNumber and PaymentNumber are Surrogate keys.
4. Are any of these keys composite keys?
Composit Key :A key that has more than one attributes is known as composite key. It is also known as compound key.
From the above example, the primary keys of the tables are MemberNumber and PaymentNumber, and a key said to be composite only if it contains multiple attributes but using MemberNumber and PaymentNumber alone we can get the details from the table.
Hence, Neither of these primary keys are Composite key.
5. Which table contains the foreign key, and what it is the foreign key?
Foreign key:
A FOREIGN KEY is a key used to link two tables together. A FOREIGN KEY is a field (or collection of fields) in one table that refers to the PRIMARY KEY in another table.The table containing the foreign key is called the child table, and the table containing the candidate key is called the referenced or parent table.
From the above tables MEMBER and PAYMENT, both have the common attribute MemberNumber and they are related by the field MemberNumber. This field is a unique identifier or a primary key in MEMBER, and serves as a non-unique identifier or foreign key in PAYMENT where it is identified by which row in MEMBER is associated with that specific row in PAYMENT. One row in MEMBER can be associated with many rows in PAYMENT, since each MEMBER pays dues each year.
Hence, MemberNumber acts as Foreign Key in Payment table.
6. Define the terms data and information. Explain how the two terms differ.
Data:
Data is a raw and unorganized fact that required to be processed to make it meaningful. Data can be simple at the same time unorganized unless it is organized. Generally, data comprises facts and figures.
Information:
Information is a set of data which is processed in a meaningful way according to the given requirement. Information is processed, structured, or presented in a given context to make it meaningful and useful.
Difference: