Zbook Chapter 1 Flashcards
Information Management System
a software application that manages corporate data for a specific business function
What is a database administrator responsible for?
Securing the database system against unauthorized users and enforcing procedures for user access and database system availability.
What does a database designer determine?
The format of each data element and the overall database structure.
What priorities must a database designer balance?
Storage, response time, and support for rules that govern the data.
What does a database programmer do?
Develops computer programs that utilize a database and writes applications that combine database query languages and general-purpose programming languages.
Who is a database user?
A consumer of data in a database who requests, updates, or uses stored data to generate reports or information.
How do database users usually access the database?
Via applications, but they can also submit queries directly to the database system.
How can small databases shared by one or two users be managed?
In a text file or spreadsheet.
Why are text files and spreadsheets inadequate for large, complex databases?
Because as databases grow in size, complexity, and use, they have special requirements that text files and spreadsheets cannot meet.
What happens to query response time when many users and applications access large databases simultaneously?
Query response time degrades rapidly.
How do database systems maintain fast response times?
By structuring data properly on storage media and processing queries efficiently.
By structuring data properly on storage media and processing queries efficiently.
Because many database users should have limited access to specific tables, columns, or rows of a database.
How do database systems ensure security?
By ensuring authorized users only access permissible data and protecting against hackers through encryption and restricted access.
What do database systems ensure regarding data consistency?
That data is consistent with structural and business rules, such as synchronizing multiple copies of data and ensuring referenced data exists.
What must database systems do in case of failures?
Recover from failures and restore the database to a consistent state without loss of data.
What is a transaction in database systems?
A group of queries that must be either completed or rejected as a whole to ensure data consistency.
Why must a transaction be processed completely or not at all?
Because executing some but not all queries can result in inconsistent or incorrect data.
Give an example of a transaction that must be processed completely or not at all.
A debit-credit transaction where $100 is transferred from one bank account to another. Both the debit and credit queries must succeed or fail together.
What must database systems do if a computer or application fails while processing a transaction?
Reverse partial results and restore the database to the values prior to the transaction.
Why is it important to prevent conflicts between concurrent transactions?
To avoid conflicts that can occur when multiple transactions access the same data at the same time.
Give an example of a conflict between concurrent transactions.
Sam selects a seat on a flight, and Maria purchases the same seat in a separate transaction before Sam completes his transaction, making the seat unavailable for Sam.
What must database systems ensure about transaction results?
That transaction results are never lost and are always saved on storage media, regardless of application or computer failures.
What does the architecture of a database system describe?
The internal components and the relationships between components.
What is the role of the query processor in a database system?
It interprets queries, creates a plan to modify the database or retrieve data, and returns query results to the application. It also performs query optimization.
How does the storage manager function in a database system?
It translates the query processor instructions into low-level file-system commands that modify or retrieve data and uses indexes to quickly locate data.
What is the responsibility of the transaction manager?
Ensuring transactions are properly executed, preventing conflicts between concurrent transactions, and restoring the database to a consistent state in the event of a failure.
What is the purpose of the log in a database system?
It contains a complete record of all inserts, updates, and deletes processed by the database, and is used by the transaction manager to restore the database in the event of a failure.
What is the catalog (or data dictionary) in a database system?
A directory of tables, columns, indexes, and other database objects used by other components to process and execute queries.
Why do database systems have different capabilities and component details?
Because some database systems do not support transactions and therefore have no transaction manager, and the storage manager implementation depends on the physical structure of data on storage media.
Steps for database query
A database system consists of:
Query processor
Storage manager
Transaction manager
Log
Catalog
An application sends queries to the query processor.
The query processor uses information from the catalog to perform query optimization.
The storage manager translates the query processor instructions into file-system commands and uses an index to quickly locate the requested data.
The transaction manager logs insert, update, and delete queries.
The result is sent back to the application.
Metadata
data about the database, such as column names and the number of rows in each table
What is a relational database?
A database that stores data in tables, columns, and rows, similar to a spreadsheet.
What does SQL stand for and what does it do?
SQL stands for Structured Query Language and includes statements to read/write data, create/delete tables, and administer the database.
For what types of databases are relational systems ideal?
Databases requiring an accurate record of every transaction, such as banking, airline reservations, and student records.
What is big data and how did it impact database systems?
Big data refers to massive volumes of online data with poorly structured or missing information, leading to the development of NoSQL systems optimized for big data.
What is NoSQL?
NoSQL stands for “not only SQL” and refers to non-relational systems optimized for big data.
How did the licensing model for database systems change after 2000?
Open source software became popular, allowing anyone to inspect, copy, and modify software with no licensing fee.
How are database systems ranked on db-engines.com?
By tracking product references on social media, internet searches, job websites, and technical websites.
CRUD operations
Create, Read, Update, and Delete data
What does the SQL statement INSERT do?
Inserts rows into a table.
What does the SQL statement SELECT do?
Retrieves data from a table.
What does the SQL statement UPDATE do?
Modifies data in a table.
What does the SQL statement DELETE do?
Deletes rows from a table.
What does the SQL CREATE TABLE statement do?
Creates a new table by specifying the table and column names.
What does the INT data type store?
Integer values.
What does the DECIMAL data type store?
Fractional numeric values.
What does the VARCHAR data type store?
Textual values.
What does the DATE data type store?
Year, month, and day.
What does VARCHAR(10) indicate?
A textual value with a maximum of ten characters.
What does DECIMAL(10, 3) indicate?
A numeric value with ten significant digits, including three after the decimal point.
What is a database design?
A specification of database objects such as tables, columns, data types, and indexes, and the process used to develop this specification.
How is the database design process different for small and large databases?
For small, simple databases, the process can be informal and unstructured. For large, complex databases, it has three phases: Analysis, Logical design, and Physical design.
What does the analysis phase specify?
Database requirements without regard to a specific database system, represented as entities, relationships, and attributes.
What is an entity in database design?
A person, place, activity, or thing.
What is a relationship in database design
A link between entities.
What is an attribute in database design?
A descriptive property of an entity.
What are some alternative names for the analysis phase?
Conceptual design, entity-relationship modeling, and requirements definition.
How are entities, relationships, and attributes depicted in ER diagrams?
Rectangles represent entities.
Lines between rectangles represent relationships.
Text inside rectangles and below entity names represent attributes.
What does the logical design phase implement?
Database requirements in a specific database system.
What does logical design convert in relational database systems?
Entities, relationships, and attributes into tables, keys, and columns.
What is a key in a table?
A column used to identify individual rows of a table.
How are tables, keys, and columns specified in SQL?
With CREATE TABLE statements.
How are tables depicted in a table diagram?
Rectangles represent tables.
Table names appear at the top of rectangles.
Text within rectangles and below table names represents columns.
Solid bullets (●) indicate key columns.
Empty bullets (○) and arrows indicate columns that refer to keys.
logical design
either a specification for tables, keys, and columns, or the process that creates the specification.
What does the physical design phase add and specify?
Adds indexes and specifies how tables are organized on storage media.
How is physical design specified?
With SQL statements such as CREATE INDEX.
Why are physical design diagrams not commonly used?
Because logical design is more important for database users and programmers.
How do logical and physical design affect queries differently?
Logical design affects the query result, while physical design affects query processing speed but not the result.
What is data independence?
The principle that physical design never affects query results, allowing performance tuning without changes to application programs.
Why is data independence important?
It allows database designers to tune query performance without changing applications, contributing to the rapid adoption of relational technology in the 1980s.
Tuple
an ordered collection of elements enclosed in parentheses.
Ex: (a, b, c) and (c, b, a) are different, since tuples are ordered.
Data Definition Language (DDL)
Defines the structure of the database.
CREATE TABLE Students (
ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT
);
Data Query Language (DQL)
Retrieves data from the database
SELECT * FROM Students WHERE Age > 18;
Data Manipulation Language (DML)
Manipulates data stored in a database
INSERT INTO Students (ID, Name, Age) VALUES (1, ‘Alice’, 20);
UPDATE Students SET Age = 21 WHERE ID = 1;
DELETE FROM Students WHERE ID = 1;
Data Transaction Language (DTL)
Manages database transactions
BEGIN TRANSACTION;
UPDATE Students SET Age = 22 WHERE ID = 1;
COMMIT;
ROLLBACK;
What is the benefit of data independence in relational databases?
Applications can be programmed before physical design is in place, running slowly but generating correct results.
What is a major limitation of SQL?
SQL lacks important programming features and is not object-oriented.
How is SQL typically used in database programming?
SQL is combined with general-purpose languages like C++, Java, or Python.
What is an API in the context of database programming?
An API is a library of procedures or classes linking a host programming language to a database.
What is JDBC?
JDBC is a library of Java classes that access relational databases.
Do programming languages support multiple database APIs?
Yes, major languages like C++ and Java support several APIs.
Why is MySQL popular?
Easy to install and use, advanced capabilities, runs on all major OS.
What are the two editions of MySQL?
MySQL Community (free) and MySQL Enterprise (paid).
What is MySQL Community suitable for?
Non-commercial applications like education.
What does MySQL Enterprise include?
MySQL Server and additional administrative applications.
What is the MySQL Command-Line Client?
A text interface included in the MySQL Server download for connecting to the database server, performing administrative functions, and executing SQL statements.
MySQL Workbench
GUI of MySQL Server
What is a database model?
A conceptual framework for database systems with data structures, operations, and rules.
What is the relational model based on?
A tabular data structure
How are the data structure, operations, and rules of the relational model standardized?
SQL
Which database models were dominant in the 1960s and 1970s?
Hierarchical and network databases.
Hierarchical Model
Data Structure: Tree
Product Release: 1960s
Example System: IMS
Strengths: Fast queries, efficient storage
Network Model
Data Structure: Linked list
Product Release: 1970s
Example System: IDMS
Strengths: Fast queries, efficient storage
Relational Model
Data Structure: Table
Product Release: 1980s
Example System: Oracle Database
Strengths: Productivity and simplicity, transactional applications
Object Model
Data Structure: Class
Product Release: 1990s
Example System: ObjectStore
Strengths: Integration with object-oriented programming languages
Graph Model
Data Structure: Vertex and edge
Product Release: 2000s
Example System: Neo4j
Strengths: Flexible schema, evolving business requirements
Document Model
Data Structure: XML, JSON
Product Release: 2010s
Example System: MongoDB
Strengths: Flexible schema, unstructured and semi-structured data
Set Theory
Concept: The relational data structure is based on set theory.
Example: {a, b, c} and {c, b, a} are the same set.
Tuple
Concept: A tuple is an ordered collection of elements.
Example: (a, b, c) and (c, b, a) are different tuples.
Table Structure
Concept: A table has a name, a fixed tuple of columns, and a varying set of rows.
Column
A column has a name and a data type.
Row
A row is an unnamed tuple of values, each corresponding to a column.
Data Type
A data type is a named set of values from which column values are drawn.
Row Order
Since a table is a set of rows, the rows have no inherent order.
Select
Selects a subset of rows of a table.
Project
Eliminates one or more columns of a table.
Product
Lists all combinations of rows of two tables.
Join
Combines two tables by comparing related columns.
Union
Selects all rows of two tables.
Intersect
Selects rows common to two tables.
Difference
Selects rows that appear in one table but not another.
Rename
Changes a table name.
Aggregate
Computes functions over multiple table rows, such as sum and count.
What are relational rules?
Logical constraints that ensure data is valid in every relational database.
What is a unique primary key?
A primary key column, or group of columns, in which values may not repeat.
What is the rule about column names in a table?
Different columns of the same table must have different names.
What is the rule about duplicate rows in a table?
No two rows of the same table can have identical values in all columns.
What are business rules?
Constraints based on business policy and specific to a particular database.
EX: Constraints based on business policy and specific to a particular database.
How are relational rules implemented?
As SQL constraints and enforced by the database system.
What is an SQL statement?
A complete command composed of one or more clauses.
How should an SQL statement be written for good practice?
Each clause should be written on a separate line.
What does a clause in an SQL statement group together?
SQL keywords (e.g., SELECT, FROM, WHERE), table names (e.g., City), column names (e.g., Name), and conditions (e.g., Population > 100000).
What does Data Definition Language (DDL) do?
Defines the structure of the database.
How do SQL statements end in MySQL?
With a semicolon.
Are SQL keywords case sensitive?
No, SQL keywords like SELECT, FROM, and WHERE are not case sensitive.
Are identifiers like column names and table names case sensitive?
Yes, in many database systems, identifiers are case sensitive.
What does Data Query Language (DQL) do?
Retrieves data from the database.
What does Data Manipulation Language (DML) do?
Manipulates data stored in a database.
What does Data Control Language (DCL) do?
Controls database user access.
What does Data Transaction Language (DTL) do?
Manages database transactions.
What is an automated script in SQL?
A series of SQL statements that is executed repeatedly.
What does the SQL statement CREATE DATABASE DatabaseName do?
Creates a new database.
What does the SQL statement DROP DATABASE DatabaseName do?
Deletes a database, including all tables in the database.
What does the SHOW statement provide?
Information about databases, database contents (tables, columns, etc.), and server status information.
What does SHOW DATABASES do?
Lists databases available in the database system.
What does SHOW TABLES do?
Lists tables available in the currently selected database.
What does SHOW COLUMNS do?
Lists columns available in a specific table named by a FROM clause.
What does SHOW CREATE TABLE do?
Shows the CREATE TABLE statement for a given table.
What is a table in a relational database?
A table has a name, a fixed sequence of columns, and a varying set of rows.
What does the USE statement do?
Selects a database and is required to show information about tables within a specific database.
What is a row in a table?
An unnamed sequence of values, with each value corresponding to a column and belonging to the column’s data type.