IT APPLICATION TOOLS IN BUSINESS TYPE OF EXAM The Hierarchy of Data I. II. III. IV. V. Hierarchy Multiple choice (Database) Identification (SQL Commands, Statement) PARTS (impress) SQL, create a statement codes, select statements SQL a. What is the result sa statement b. Update, increase, insert, select - Field - LESSON 1: DATABASE MANAGEMENT Database - Collection of data organized so you can access, retrieve, and use it Database software also called database management system (DBMS) Database software allows you to o Create database o Add, change, and delete data o Sort and retrieve data o Create forms and reports - How are data and information related? - Data is raw facts Information is data that is organized and meaningful receipt Computers process data into information - Data integrity - Combination of one or more characters Smallest unit of data user accesses o Field size defines the maximum number of characters a field can contain o Field name uniquely identifies each field o Data type specifies kind of data field contains common data types Data and Information - Database contains files, file contains records, record contains fields, field contains characters Degree to which data is correct o Garbage in, garbage out (GIGO)— computer phrase that means you cannot create correct information from incorrect data o Garbage in, Garbage out, Data integrity is lost Text (also called alphanumeric)—letters, numbers, or special characters Numeric numbers only AutoNumber unique number automatically assigned to each new record Currency dollar and cent amounts or numbers containing decimal values Date month, day, year, and sometimes time Memo lengthy text entries Yes/No (also called Boolean)— only the values Yes or No (or True or False) Hyperlink Web address that links to document or Web page Object (also called BLOB for binary large object)— photograph, audio, video, or document created in other application such as word processing or spreadsheet Record - Group of related fields Key field, or primary key, uniquely identifies each record What are the qualities of valuable information? Data file 1. 2. 3. 4. 5. 6. - Accurate Verifiable Timely Organized Accessible Useful 1 Collection of related records stored on disk IT APPLICATION TOOLS IN BUSINESS Maintaining Data database approach File Maintenance - - Procedures that keep data current o Adding records o Changing records o Deleting records Strengths of the database approach - Why do you add records? - Add new record when you obtain new data Why do you change records? - Many programs and users can share data in database Secures data so only authorized users can access certain data Reduced data redundancy Improved data integrity Shared data Easier access Reduced development time Database Management Systems Correct inaccurate data Update old data popular database management systems (DBMSs) Why do you delete records? - When record no longer is needed Some programs remove record immediately, others flag record Validation - Process of comparing data with a set of rules to find out if data is correct Reduce data entry errors and enhance data integrity before program writes data on disk Types of validity checks 1. Check Digit number(s) or character(s) appended to or inserted into a primary key value to confirm accuracy of primary key value 2. Alphabetic/ Numeric Check ensures correct type of data entered 3. Range Check determines whether number is within specified range 4. Completeness Check verifies that a required field contains data 5. Consistency Check tests for logical relationship between two or more fields Data dictionary - Query - File Processing Versus Databases - Request for specific data from a database Query language consists of simple, English-like statements that allow users to specify data to display, print, or store Form File processing system - Contains data about each file in database and each field within those files - Each department or area within organization has own set of files Records in one file may not relate to records in any other file May have weaknesses: o Data redundancy— same fields stored in multiple files o Isolated data—data stored in separate files so it is difficult to access - Window on screen that provides areas for entering or changing data in database Used to retrieve and maintain data in a database Form that sends data across network or Internet is called e-form, short for electronic form Report generator 2 Allows user to design a report on screen, retrieve data into report design, then display or print reports IT APPLICATION TOOLS IN BUSINESS - Also called report writer data security - DBMS provides means to ensure only authorized users can access data Access privileges define activities that specific user or group of users can perform o Read-only privileges - user can view data, but cannot change it o Full-update privileges - user can view and change data Backup and Log - Backup is a copy of the entire database Log is a listing of activities that change database contents o DBMS places three items in log: before image, actual change, and after image Recovery utility - - Relational database Uses logs and/or backups to restore database when it is damaged or destroyed Rollforward—DBMS uses log to re-enter changes made to database since last save or backup. Also called forward recovery Rollback—DBMS uses log to undo any changes made to database during a certain period of time â–ªAlso called backward recovery. - - Stores data in tables that consist of rows and columns o Each row has primary key o Each column has unique name Stores data relationships Uses specialized terminology Relational, Object-Oriented, and Multidimensional Databases Data model - Rules and standards that define how database organizes data Defines how users view organization of data Three popular data models o Relational o Object-oriented o Object-relational o Multidimensional Structured Query Language (SQL) - Allows you to manage, update, and retrieve data Has special keywords and rules included in SQL statements What are guidelines for developing a database 1. Determine the purpose of the database 2. Design the tables a. Design tables on paper first b. Each table should contain data about one subject 3. Design the records and fields for each table a. Be sure every record has a unique primary key 3 IT APPLICATION TOOLS IN BUSINESS b. Use separate fields for logically distinct items c. Do not create fields for information that can be derived from entries in other fields d. Allow enough space for each field e. Set default values for frequently entered data 4. Determine the relationships among the tables calculus. It includes also command to insert, delete and modifying in the database. 3. View Definition – the SQL DDL also includes commands for defining views. 4. Authorization – the SQL DDL includes commands for specifying access rights to relation and views. 5. Integrity – the SQL provides forms of integrity checking. Future products and standard of SQL are likely to include enhanced features for integrity checking. role of the database analyst and administrator Relational Data Structure Database analyst (DA) - - Focuses on meaning and usage of data Decides proper placement of fields, defines relationships, and identifies users’ access privileges Database administrator (DBA) - Creates and maintains data dictionary, manages database security, monitors database performance, and checks backup and recovery procedures A relational data structure is a collection of tables or relations. o A relation is a collection of rows or tuples o A tuple is a collection of columns or attributes o A domain is a pool of values from which the actual attribute values are taken. CREATE TABLE CODE create table stud_info SQL (stud_no numeric(6) not null, SQL - - last_name varchar(20) not null, The structure query language is language that enables to create and operate on relational database, which are sets of related information stored in tables. It has clearly established itself as the standard relational database language. It is basically used to pass the query to retrieve and manipulate the information from database, depending upon the nature of query. SQL can: o Create Schemas in the DBMS o Alter Schemas o Add data o Remove data o Change data o Access Data first_name varchar(20) not null, middle_name varchar(20), course varchar(30) not null, primary key (stud_no) ); describe stud_info; ALTER statements: To modify an existing database object. alter table stud_info Processing Capability of SQL: add (address varchar(60) not null); 1. Data Definition Language (DDL) – it provides commands for defining relations schemas, deleting relations, creating index, and modifying relations schemas. 2. Data Manipulation Language (DML) – it includes the queries language based on both the relational algebra and the tuples relational Dropping a column from a table: alter table stud_info drop column address; 4 IT APPLICATION TOOLS IN BUSINESS DROP statements: To destroy an existing database, table, index, or view. If a table is dropped all records held within it are lost and cannot be recovered. - drop table Stud_info; ADDITIONAL COMMAND LISTS: - alter table stud_info modify course varchar(50); alter table stud_info add (birthday date not null); - insert into stud_info values(92213,'Maligsa','Katherine','Esguerra','BS Computer Science','11/30/1995'); FROM CAR WHERE COLOR != 'RED'; SELECT REGNO, COLOR, PRICE update stud_info FROM CAR set middle_name = 'Unica' WHERE COLOR != 'RED'; DATE where first_name = 'Rickz' - DELETE statement removes one or more records from a table. A subset may be defined for deletion using a condition, otherwise all records are removed. Date comparisons can be tricky You can use all the normal comparators with dates. SELECT name, dob from driver delete from stud_info where DOB = ‘1986-12-03’; where first_name = 'Eric' SELECT name, dob SELECT statement returns a result set of records from one or more tables. - Valid comparisons include =, !=, <>, <=, >, >= SELECT * UPDATE statement that changes the data of one or more records in a table. Either all the rows can be updated, or a subset may be chosen using a condition - Formatting o SPACES do not matter o NEWLINES do not matter o Good practice to put ; at the end of the query. o CASE (except between single quotes) does not matter. Comparisons INSERT statement adds one or more records to any single table in a relational database. - o SELECT<attribute list> o FROM<table list> o WHERE<condition> EXAMPLE: o SELECT * o FROM CAR o WHERE COLOR = 'RED'; from driver WHERE DOB >= ‘1981-01-01’; WHERE specifies which rows to retrieve GROUP BY groups rows sharing a property so that an aggregate function can be applied to each group having group. HAVING selects among the groups defined by the GROUP BY clause. BETWEEN - ORDER BY specifies an order in which to return the rows. o Syntax: When dealing with dates sometimes you want to test to see if a field value falls between two dates. The easiest way to do this is with BETWEEN NULL 5 NULL indicates that something has no value IT APPLICATION TOOLS IN BUSINESS SELECT regno from car WHERE OWNER = ' '; LIKE - Sometimes you want to have a rule involving partial strings, substrings, or wildcards LIKE does this, and is a slot-in replacement for ‘=‘ If the string contains ‘%’ or ‘_’, LIKE uses them to support wildcards. o % - Matches 0 or more characters in the string o _ - Matches exactly 1 character in the string 6