atabase roles
D
People interact with databases in a variety of roles:
● A database administratoris responsible for securingthe database system against
unauthorized users. A database administrator enforces procedures for user access and
database system availability.
● Authorization. Many database users should have limitedaccess to specific tables,
columns, or rows of a database. Database systems authorize individual users to access
specific data.
● Rules. Database systems ensure data is consistentwith structural and business rules.
Ex: When multiple copies of data are stored in different locations, copies must be
synchronized as data is updated. Ex: When a course number appears in a student
registration record, the course must exist in the course catalog.
● Thequery processorinterprets queries, creates aplan to modify the database or retrieve
data, and returns query results to the application. The query processor performsquery
optimizationto ensure the most efficient instructionsare executed on the data.
● Thestorage managertranslates the query processorinstructions into low-level
file-system commands that modify or retrieve data. Database sizes range from
megabytes to many terabytes, so the storage manager usesindexesto quickly locate
data.
● Thetransaction managerensures transactions are properlyexecuted. The transaction
manager prevents conflicts between concurrent transactions. The transaction manager
also restores the database to a consistent state in the event of a transaction or system
failure.
MongoDB MongoDB NoSQL Open source 5
● I NSERTinserts rows into a table.
● SELECTretrieves data from a table.
● UPDATEmodifies data in a table.
● DELETEdeletes rows from a table.
he SQLCREATE TABLEstatement creates a new tableby specifying the table and column
T
names. Each column is assigned adata typethat indicatesthe format of column values. Data
types can be numeric, textual, or complex.Ex:
● INT stores integer values.
● DECIMAL stores fractional numeric values.
● VARCHAR stores textual values.
● DATE stores year, month, and day.
, A
● nalysis
● Logical design
● Physical design
heanalysisphase specifies database requirementswithout regard to a specific database
T
system. Requirements are represented as entities, relationships, and attributes. An entity is a
person, place, activity, or thing. A relationship is a link between entities, and an attribute is a
descriptive property of an entity.
nalysishas many alternative names, such as conceptualdesign, entity-relationship modeling,
A
and requirements definition.
ogical design
L
Thelogical designphase implements database requirementsin a specific database system. For
relational database systems, logical design converts entities, relationships, and attributes into
tables, keys, and columns.
hysical design
P
Thephysical designphase adds indexes and specifieshow tables are organized on storage
media. Physical design affects query processing speed but never affects the query result. The
principle that physical design never affects query results is calleddata independence.
o simplify the use of SQL with a general-purpose language, database programs typically use an
T
application programming interface. Anapplicationprogramming interface, orAPI
ySQL Command-Line Client
M
TheMySQL Command-Line Clientis a text interfaceincluded in the MySQL Server download.
MySQL Server returns anerror codeand descriptionwhen an SQL statement is syntactically
incorrect or the database cannot execute the statement.
.Atupleis an ordered collection of elements enclosedin parentheses.Ex:(a, b, c)and(c, b, a)
are different, since tuples are ordered.
The data structure organizes data in tables:
A
● tablehas a name, a fixed tuple of columns, anda varying set of rows.
● Acolumnhas a name and a data type.
● Arowis an unnamed tuple of values. Each value correspondsto a column and belongs
to the column's data type.
● Adata typeis a named set of values, from which columnvalues are drawn.