Introduction to Database System (The Basics)-Discuss the Answer

Description: This discussion is based on the answers Introduction to Database Systems China MOOC- University (Elementary) video recording.
Notes: Introduction to Database Systems (The Basics)-Notes

Lecture 1: Getting to know the database system first

First video: Introduction

  1. The four winners of Turing Awards?
    –CWBachman (Bachman), EFCodd, James Gray, MRStonebrake.

The second video: 4 basic concepts of the database

  1. The database management system can realize the query, insertion, modification and deletion of the data in the database. This kind of function is called?
    – Data manipulation function.

  2. What is the semantics of data? Why is data inseparable from its semantics? Can be illustrated.
    The meaning of data is called the semantics of the data, and the data and its semantics are inseparable. If the representation of the data cannot fully express its content, it needs to be explained.
    Example: Student records in student files: (Li Ming, male, 199505, Nanjing, Jiangsu, Computer Department, 2013).

  3. What is a database? What is a database management system? Explain the difference and connection between the two.
    A database is an organized, sharable collection of large amounts of data stored in a computer for a long time.
    The database management system is a layer of data management software between the user application and the operating system; it is the basic software and a large and complex software system.
    Difference: The database refers to a collection of data. The database management system is the database management software between the operating system and the database application system.
    Contact: The existence of a database management system makes the data in the database easy to use and maintain.

The third video: The emergence of data technology, the characteristics of data systems

  1. In the three stages of data management technology development, there is no special software to manage data?
    –Manual management stage.

Lecture 2: The core of the database system: data model

The first video: Conceptual model, components of data model

  1. The relational data model is currently the most important data model. What are its three elements?
    Data structure, relational operations, integrity constraints.
  2. Examples: entities, entity types, entity sets, and the relationships between entities.
    Entity: Objects that exist objectively and are distinguished from each other are called entities.
    Entity type: Using entity name and its attribute name set to abstract and characterize the same type of entity is called entity type.
    Entity type: Using entity name and its attribute name set to abstract and characterize the same type of entity is called entity type.
    The connection between entities: usually refers to the connection between different sets of entities; the relationship between entities is one-to-one (1: 1), one-to-many (1: n), many-to-many (m: n).

Second video: Hierarchical model, mesh model

  1. In what can a node have multiple parents, and there can be multiple connections between nodes?
    Mesh model.

Third video: Relationship model

  1. What is the basic data structure of the relational data model?
    relationship.

Lecture 3: Structure of the database system

  1. What is the logical independence of data?
    The mode changes, the external mode and the application remain unchanged.
  2. What is the physical independence of data and programs? What is the logical independence of data and programs? Why is the database system independent of data and programs?
    Physical independence of the data and the program: When the storage structure of the database changes (for example, another storage structure is selected), the database administrator modifies the mode / internal mode image so that the mode remains unchanged, so that the application remains unchanged. The physical independence of the data and the program is ensured, or the physical independence of the data for short.
    The logical independence of the data and the program: When the mode changes, the database administrator changes the external mode / mode image accordingly to keep the external mode unchanged; the application is written according to the external mode of the data, and the application does not need to be modified, which guarantees The logical independence of data and program, referred to as the logical independence of data.
    The database system has the independence of data and programs: Because the two-level mapping function provided by the database management system ensures the physical and logical independence of the data, thereby ensuring the stability of the application; and the data access is controlled by the database management system Management, thereby simplifying the preparation of application programs, greatly reducing the maintenance and modification of application programs.

Lecture 4: Composition of the database system

  1. Database system consists of database, database management system, application system and what?
    Database administrator.

Lecture 5: Relational Data Structure and Relational Integrity

First video: Relational data structure

  1. What is the difference between the "relationships" in a relational database and the "tables" common in everyday life?
    There can be no duplicate tuples in the relationship, the same row can appear in the table,

  2. Does the more tuples in a relationship, the richer the information described?
    Not necessarily.

Second video: Relationship integrity

  1. The integrity constraints that must be satisfied in the relational model include?
    Entity integrity, referential integrity.
  2. If the database has only one relationship, is there no referential integrity?
    No.

Lecture 6: Relational Algebra-Traditional Set Operations

  1. What is the operation object and operation result of relational algebra?
    relationship.
  2. There are two student score sheets, table 1 (student number, name, math scores), and table 2 (student number, name, physical grades). May I ask whether these two tables can be combined and operated? why?
    No, the domains are different.

Lecture 7: Relational Algebra-Relational Specific Operations

  1. Suppose A in the relationship R (A, B, C) is the code, R1 (A, B) and R2 (A, C) are the two relationships respectively projected from R, please ask R1 (A, B) Join R2 ( A, C) = R (A, B, C) (Note: Join is a natural connection)
    When the function relies on A–> B and A–> C to hold on R, the relationship R (A, B, C) is equal to its Project the natural connection of R1 (A, B) and R2 (A, C)

Lecture 8: Relational Algebra-Comprehensive Training

  1. Equivalent relational expression given by expression of two or more different, the result is the same: Elective student list database (number, name)
    [pi SNO, SNAME (a CNAME = [sigma] 'Database' (S∞SC∞ C))
    π sno, sname (S ∞ (π sno (SC ∞ (σcname = 'database' (C)))))

Lecture 9: Relational Calculus-Tuple Relational Calculus

  1. Can the examples of relational calculus introduced in the lecture be expressed in relational algebra equivalent? How to express it concretely?
    Take the simplest three in the video as an example
    [Example 1] to query all the selected course numbers.
    GET W (SC.Cno)
    [Example 2] Query the data of all students.
    GET W (Student)
    [Example 3] GET W (Student.Sno, Student.Sage):

Lecture 10: Relational Calculus-Domain Relational Calculus Language QBE

  1. Please analyze the characteristics of the QBE language.
    QBE is a typical domain relational calculus language. The component of the tuple variable, the domain variable, is used as the basic object of the predicate argument. QBE also refers to this relational database management system. QBE is a query language based on screen forms. The query requirements: construct the query by filling in the form, and use instance elements (domain variables) to indicate the possible results of the query results. The query results: expressed in the form of a table .

Lecture 11: SQL Overview and Data Definition

First video: SQL overview

  1. How to understand that SQL is a non-procedural language When
    SQL performs data operations, it only needs to consider what to do, no need to think about what to do, and users do not need to understand the access path, the choice of access path and the operation process of SQL is completed by the system.

Second video: data definition

  1. Why not need an alter view statement?
    Because the view is a table derived from one or several basic tables, users can view the data in the database from a specific angle, which is different from the basic table and is a virtual table. The database only stores the definition of the view and does not store the data corresponding to the view, so there is no need to delete the ALTER VIEW statement.

Lecture 12: Data Query-Single Table Query

  1. How to make the column display order of the query result not the same as the column order
    in the database When entering objects during the query process, enter the column names in the order of the columns you want. The results will be arranged in the order in which the column names are entered, not in the order of the columns in the table.
    If “SELECT *”, the column display order of the query result is the same as the column order in the database; if “SELECT <>, <>, <>,…”, each column of the data table will be a complete column in the order you want Out, you can achieve the purpose of the column display order and the column order in the database is different.

Lecture 13: Data Query-Connection Query

  1. How to understand "natural connection", how is it different from equivalent connection?
    1. Natural connections must be equivalent connections, but equivalent connections are not necessarily natural connections.
    2. Equivalent connection requires equal components, not necessarily public attributes; while natural connection requires equal components must be public attributes.
    3. Equivalent connections do not remove duplicate attributes; natural connections remove duplicate attributes.

Lecture 14: Data Query-Nested Query

The first video-nested query 1

  1. What is "irrelevant subquery"? , How to convert into a connection query?
    Unrelated subqueries, inner queries do not depend on the outer layer. During the execution process, the inner query is executed first. The result of the inner query is not displayed, but is passed to the outer query as a condition of the outer query. Then the outer query is executed and the query result is displayed. Converting to join query is to connect the inner table of the subquery with the outer table
  2. How to understand the return result of EXIST subquery?
    The subquery with the EXISTS quantifier does not return any actual data, it only produces a logical true value or a logical false value. If the inner query result is not empty, the outer WHERE clause returns true, otherwise it returns false.

Lecture 15: Data Query-Collection Query

  1. Under what circumstances can two queries perform UNION operation by themselves?
    1. The SELECT statement inside UNION must have the same number of columns. Columns must also have similar data types. At the same time, the order of the columns in each SELECT statement must be the same.
    2. Duplicate values ​​in the result set connected by this command will not be displayed. To ignore duplicate values, you can use union all.

Lecture 16: Data Update and Control Processing

The first video-data update

  1. Can I use insert and delete operations to achieve update operations, how to do?
    Yes, first delete the data you want to delete with the DELETE FROM WHERE statement, and then use the INSERT INTO VALUES statement to insert new data, so that the data is updated

Second video-Null value processing

  1. For a numeric field, is the null value the same as the 0 value?
    Null and 0 are not the same.
    (1) Null value refers to the value of "don't know", "meaningless" or "does not exist", which can be judged by IS NULL or IS NOT NULL in the query statement;
    (2) 0 value refers to a certain value type field Determine the value.

Lecture 17: Views

The first video-view 1

  1. Please explain the role of the with CHECK option clause?
    1. For update, with check option, to ensure that the data is queried by the view after update;
    2. For delete, with or without check option;
    4. For insert, with check option, to ensure after insert, The data should be queried by the view;
    5. For views without a where clause, using with check option is redundant.
    On the role of WITH CHECK OPTION

Second video-View 2

  1. Why does the view mechanism provide logical independence of data?
    A view is a table derived from one or several basic tables (or views), and is a "virtual table". The database only stores the definition of the view, and does not store the data corresponding to the view.

Lecture 18: Overview of Database Security

  1. Analyze what unsafe factors the database has and give examples.
    1. Malicious access and destruction of the database by unauthorized users (hackers and criminals hunt for legal user information)
    2. Important or sensitive data in the database is leaked (hackers and hostile elements steal secrets)
    3. The security environment is vulnerable (and The security of the computer system is closely linked)

Lecture 19: Database Security Control

The first video: identity authentication, access control, autonomous access control, authorization

  1. What are the common methods of database security control, and how does autonomous access control ensure database security?
    1. User identity authentication (static password, dynamic password, biometrics, smart card, etc.);
    2. Access control (define user rights, legal authority verification);
    3. View;
    4. Audit;
    5. Data encryption;
    autonomous access Control:
    1. Users have different access rights to different data objects;
    2. Different users also have different rights to the same object;
    3. Users can delegate their access rights to other users

Second video: Database roles and mandatory access control

  1. What is mandatory access control and what is the difference between it and autonomous access control? Why can mandatory access control better guarantee database security?
    Mandatory access mechanism: All entities are divided into two parts: subject and object.
    The subject is an active entity, and the object is a passive entity and is manipulated by the object.
    Each subject and object is assigned a sensitivity mark, and subject intelligence accesses data through corresponding rules.
    In mandatory access control, users cannot directly perceive or control, so they can better ensure the security of data.

Lecture 20: View Mechanism

  1. What is a database audit? How does it guarantee database security?
    The database security audit system effectively monitors database access activities, accurately grasps the security status of the database system, promptly discovers operations that violate database security policies, and alarms and records in real time to realize the location analysis of security incidents, follow-up investigation and evidence collection, and comprehensively protect the database security .

Lecture 21: Database Integrity

First video: Overview of database integrity and physical integrity

  1. What is the function of the DBMS integrity control mechanism? What parts does it consist of? How do these parts work together?
    Function: To
    prevent legitimate users from legally inserting incorrect data into the database. The
    three parts are:
    1. Provide a mechanism for defining integrity constraints
    2. Provide a mechanism for checking integrity constraints
    3. Provide a default handling
    cooperation for integrity constraints :
    Define first The mechanism of integrity constraints, such as the primary key, and then check the integrity constraints when data is inserted or updated, if the integrity constraints are violated, such as the uniqueness of the primary key is violated, then the corresponding default treatment is provided.

Second video: Referential integrity

  1. Describe the definition of referential integrity, the timing of inspection and the definition of various types of default handling methods
    : referential integrity uses FOREIGN KEY phrases in CREATE TABLE to define which columns are foreign codes, and REFERENCES phrases indicate which tables are referenced by these foreign codes. . Timing of inspection: Check when adding, deleting, or modifying the referenced table and the reference table. The referenced table may damage the reference integrity, the reference table is inserted into the tuple, and the default processing is rejected; the referenced table may damage the reference integrity, the reference table modifies the foreign code value, and the default processing is rejected; the referenced table deletes the tuple, the reference table It may damage the referential integrity. The default processing is rejection, concatenated deletion, and set to a null value. If the main code value is modified by the reference table, the reference table may damage the referential integrity. The default processing is rejection, concatenated modification, and set to a null value.

Third video: User-defined integrity

  1. Describe the method of user-defined integrity, check the timing and various types of default handling methods.
    While defining attributes in CREATE TABLE, you can define the constraints on attributes according to application requirements, that is, attribute value restrictions, including: column values ​​are not empty, column values Unique, check if the column value satisfies a conditional expression (CHECK phrase). When inserting tuples into the table or modifying attribute values, the relational database management system will check whether the constraint conditions on the attributes are met, if not, the operation is rejected carried out.

Lecture 22: Constraint Naming Clauses and Assertions

  1. What is the purpose of the assertion? In the student-course-selection database, how to define the assertion that "each student can take up to 7 courses per semester"?
    The purpose of the assertion:
    specify more general constraints;
    you can define more complex integrity constraints involving multiple tables or focused operations;
CREATE ASSERTION ASSE_SC_SNUM
CHECK(7>=ALL(SELECT COUNT(*)
               FROM SC
               GROUP by sno,TERM));

Lecture 23: Triggers

  1. Can multiple triggers be defined on a table? If so, what is the order of execution of these triggers?
    You can define multiple triggers on a table.
    Execution order:
    (1) Execute BEFORE trigger on the table;
    (2) Activate the SQL statement of the trigger;
    (3) Execute the AFTER trigger of the table;
  2. What are the methods of RDBMS to define integrity constraints?
    (1) Entity integrity;
    (2) Referential integrity;
    (3) User-defined integrity;
    (4) Assertion;
    (5) Trigger;

"Recommended Article"
Introduction to Database System (Basic)-Notes
How to use wizard to create database and basic table structure? (SQL Server 2014)
Use database DDL language to create database and basic table? (SQL Server 2014)

Published 99 original articles · Like 49 · Visitors 40,000+

Guess you like

Origin blog.csdn.net/weixin_46218781/article/details/105465321