Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
41
Syllabus
Explain the purpose of a database management system (DBMS), query languages and data dictionaries. Describe the advantages of different users having different views of the data in a database. Discuss different approaches to database security. Recognise that the individual user of a database may be prevented from accessing particular elements of the information. Explain the role of the database administrator. Explain what is meant by data warehousing and data mining, using examples from supermarkets and insurance companies.
SQL
SQL is a language used to extract data from relational databases. It is available in various versions and embedded into database applications, such as Microsoft Access. It performs the same function as a QBE, in that it searches and sorts data. When you create a QBE, Access writes the SQL automatically. SQL is written in lines of code (like a programming language) to extract and sort data from several entities within a relational database.
SQL statements
A typical SQL statement might look like this:
SELECT CustomerName, Address FROM Customer WHERE CustomerName = John Smith ORDER BY CustomerName DESC
This statement will extract the customer name and address from the Customer entity of all customers called John Smith sorting the results in descending order based on the customer name.
SQL commands
SELECT identifies the attributes that you want to extract. These can be from one or more tables. FROM indicates the table or tables that the data is to be extracted from. WHERE is the condition that must be met. These can be complex (using AND/OR) or you may not have any conditions at all. ORDER BY indicates the sort order of the extracted data. The default is ascending so DESC is added to make it descending.
Further examples
SELECT * FROM Customer WHERE CustomerName = "John Smith" or "Mary Jones"
will extract all attributes (because the wildcard * is used) from the customer entity where the name is either John Smith or Mary Brown.
SELECT * FROM VIDEO WHERE VideoPrice BETWEEN 2 AND 2.50
will extract all attributes from the video table where the price of the video is between 2 and 2.50.
2005 Bob Reeves, Dave Fogg/Hodder Murray
Note the convention Customer.CustomerName to extract the attributes. The entity name is also given in this case as there are several entities being queried.
Data dictionary
The DBMS records the structure of the database. It records the attributes, data types, validation used and the relationship between entities. Any changes to the data structure are recorded in the data dictionary. Any requests to access the data are directed via the data dictionary. The DBMS then presents the appropriate table. The data dictionary does not store the data itself. It records the structure of the data. This leads to the concept of program-data independence. The data and the programs that are used to access it are not directly linked.
Database schema
There are three views of the database: external schema: the way in which the users see the database. The complexities of the data are hidden from the user so this view is the front-end conceptual or logical schema: describes the structure relationships and the entities and attributes internal schema: describes how the data will be stored physically and how it will be accessed and updated.
Database servers
In a network, a dedicated server may hold the database. Access to the database therefore is via this server and all changes made to the database are made on the copy stored on the server. On a traditional network, the server would store the database and send it to the workstation when a user requested it. The integrity of the data is maintained with a database server as there is only ever one copy.
Database administrator
The database administrator is the person responsible for maintaining the database, including... designing the database keeping users informed of changes maintenance of the data dictionary for the database implementing database security measures allocating passwords providing training to users ensuring adequate backup procedures.
Home work
Research and write a at least 1 paragraph on the following subjects: Data warehousing Data mining using examples from supermarkets and insurance companies.