IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure...
-
Upload
susan-tucker -
Category
Documents
-
view
218 -
download
2
description
Transcript of IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure...
![Page 1: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/1.jpg)
IS6146 Databases for Management Information SystemsLecture 1: Introduction to IS6146
![Page 2: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/2.jpg)
IS6146
Lecture times 13.00-15.00, Wednesday (KANE B10A)
Contact me at Ext 2503 Room 2.112 [email protected]
Website for this course robgleasure.com
![Page 3: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/3.jpg)
IS6146 Module content and learning outcomes
Using databases (i.e. SQL) Semistructured data (i.e. XML) Unstructured data
![Page 4: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/4.jpg)
IS6146
Course Assessment Continuous assessment: 50 marks
In-class exam* – 20 marks Group report* – 30 marks
Exam: 50 marks
* To be confirmed
![Page 5: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/5.jpg)
Database Management Systems A Database Management System (DBMS) is a software package
designed to store and manage databases.
This is different from a database file for several reasons DBMS makes tables visible and generates reports DBMS helps less technical users to use data efficiently DBMS protects data from inconsistency and duplication due to
multiple concurrent users DBMS handles crash recovery DBMS handles security and access control
![Page 6: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/6.jpg)
Database Management Systems DBMS operates at the physical level
This is where data handling becomes increasingly technical
Physical model
Logical model
Conceptual modelManagement and business
users
Database administrators
System analysts
and designers
![Page 7: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/7.jpg)
Database Management Systems DBMS are typically managed by a set Database Administrator,
whose responsibilities include Defining or refining logical schema in response to requirements Granting appropriate access to users Monitoring DBMS performance Updating/changing DBMS software
![Page 8: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/8.jpg)
Database Management Systems Other users will include
Application developers (write programs that need to access/modify data)
Sophisticated/specialised users (use DBMS directly to generate reports and assist business analysis)
Naïve users (use applications that access/modify data)
![Page 9: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/9.jpg)
Examples of DBMSOracleLarge multi-user DBMS that excels at handling many clients requesting, accessing, and modifying dataPopular in large organisations and cloud services due to scalabilityVery effective handling of concurrency, read consistency, parallel execution, and locking mechanisms
MS AccessPopular DBMS for small scale projects due to its relatively low cost and usabilityImports and exports data to many formats commonly used in organisations, e.g. Excel, Outlook, SQL Server, OracleIntegrates easily with MS tools like VB, C# and .NET
![Page 10: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/10.jpg)
Examples of DBMS
MySQLOpen source SQL database with free and paid versionsFlexible and scalableOpen source means lots of support and the potential for adaptability
MS SQL ServerGood performance XML integrationInclusion of try/catch queries
![Page 11: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/11.jpg)
Comparison of DBMS from lab manuals (out of 5 stars)
Oracle MS Access MySQL MS SQL Server
Cost 2.5 4 5 3
Web friendly 3 3 3 3.5
Reliable 4 2 3 4.5
Complex 3 2 4 4.5
Security 4 3 3 3
Capacity 3.5 2 3 5
Flexibility 3 2 4 4
Technical fit 3 2 4 5
Ease of use 3 4.5 3 4.5
![Page 12: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/12.jpg)
Accessing a DBMS with SQL
So once we have our data models in place and our DBMS set up, how do we get started using our data?
The SQL (pronounced like sequel) query language
SQL (Structured Query Language) was introduced in the 70’s and has evolved since to add features such as Compatibility with object-oriented programming Compatibility with XML Compatibility with XQuery
![Page 13: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/13.jpg)
Accessing a DBMS with SQL
![Page 14: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/14.jpg)
The Structure of SQL
SQL can be divided into two parts: The Data Manipulation Language (DML)
Used to create, read, update and delete tuples (CRUD operations)
Mostly used by application programmers and sophisticated/specialised users
The Data Definition Language (DDL) Used to define database structure (relation schemas) and
data access control, as well as integrity constraints and views Mostly used by database administrator
![Page 15: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/15.jpg)
Executing SQL in a DBMS
![Page 16: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/16.jpg)
Accessing DBMS with SQL
The basic syntax of SQL queries are as follows:
COMMAND column_name1, column_name2, …
FROM/SET/VALUES table_name1, table_name2, …
WHEREcolumn_name comparison_operator value;
All statements in a semi-colon
![Page 17: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/17.jpg)
The SQL Select statement
The SELECT statement is used to retrieve data from a database into a result table, or result-set
You can use an asterisk (*) instead of a column name if you wish to select all columns satisfying the criteria
e.g. SELECT * FROM my_table;
![Page 18: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/18.jpg)
The SQL Select statement
Let’s open up an online example from W3Schools http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all
![Page 19: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/19.jpg)
The SQL Select statement
Sometimes non-primary key columns may contain duplicate values - you can also use SELECT DISTINCT when you want to avoid duplicates in your result-set
e.g. SELECT DISTINCT * FROM my_table;
![Page 20: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/20.jpg)
The SQL Where clause
A number of comparison operators are possible with the WHERE clause
Examples http://www.w3schools.com/sql/
trysql.asp?filename=trysql_select_between_in
http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_in
Operator Description= Equal
<>, != Not equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an range of numbers
LIKE Searches for patterns
IN When a specific value is sought
![Page 21: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/21.jpg)
The ‘LIKE’ condition and Wildcards Sometimes we want to identify records based on slices of the data
within a cell - we do this using wildcards and the LIKE condition
Examples http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_wildcard_percent http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_wildcard_underscore http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_wildcard_charlist&ss=-1
Wildcard Description% A substitute for zero or more characters_ A substitute for a single character[charlist] Sets and ranges of characters to match[^charlist]or [!charlist]
Matches only a character NOT specified within the brackets
![Page 22: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/22.jpg)
The SQL Where clause (continued) Numerous clauses can be combined with the keywords AND & OR
e.g.SELECT * FROM my_table WHERE val1=‘true’ AND val2=‘false’;
Complex clause can be creates by nesting clauses in parentheses e.g.
SELECT * FROM my_table WHERE val1=‘true’ AND (val2=‘false’ OR val2=‘null’);
Examplehttp://www.w3schools.com/sql/trysql.asp?filename=trysql_select_where_and_or
![Page 23: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/23.jpg)
The SQL Order By keyword
The ORDER BY keyword is used to sort the result-set e.g.
SELECT * FROM my_table ORDER BY NAME;
You may also specify whether you want the returned result-set to be sorted in ascending or descending order by using the keywords ASC or DESC
e.g. SELECT * FROM my_table ORDER BY NAME DESC;
Example http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_orderby_desc
![Page 24: IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a4d1af47f8b9ab059980607/html5/thumbnails/24.jpg)
Readings
http://www.w3schools.com/sql http://www.tizag.com/sqlTutorial/