Download as pdf
Download as pdf
You are on page 1of 72
Database Management System (OpenOffice dBase) | Database management system 2 Create and edit tables using wizard and SQL Commands Perform operations on table Retrieve data using query Create forms and reports using wizard 1; Database Management System In this Lesson - 4 Concept of database 4 Advantages of database 4 Database management system % Disadvantages of database 4 Relational database management system (RDBMS) Users of a database management system Introduction Computers are used in business and industry for diverse purposes. For example, an industry might be using computer for storing sales data, inventory control, production scheduling and similar activites. An educational institute might be tusing computers for storing the information about the performance of the students, college dues paid by them and the amount received by them as scholarships or other forms of financial assistance. Every software for such a system uses its own data files f this softwares have been designed forthe same organization, then the same data may be used indifferent files for different purposes. For example, the name, address and the roll number ofa student may be present in both the result file as well as the payment files, which stores the information made by students as fees leading to duplication and redundancy. This is difficult to manually maintain and hence computerised database management system is used. habe por 3) datebose Concept of Database 1 “A database is a collection of logically related data to meet the information needs of one or more users) In 2 database, “elated data files are designed to contain as much information as possible about an organization. Organizations seeking computer assistance prefer to store their data in a form of an integrated database. Database isan organized body of elated information. Database management system is a systematic apprdach for creating, maintaining, accessing, reporting and analysing data. The term database can also be defined as a collection of records stored in a computer in a systematic way so that a computer program can consult it to answer questions. For better retrieval and sorting records, it is usually organized as a set of data elements/A person.of the organization is assigned the responsibility to maintain the database. He is designated as the Database Administrator (DBA). > - 7 Info Byte —— ‘A database is a collection of related data” A DBMS (Database Management System) js a set of software programs that controls the organization, storage, managerienaMe TETRIEVAT Of data in a database. aa Database Management System (OpenOffice dBase) fo2ss} x Database Management System \ database management system (DBMS) is a computer-based collection of interrelated data called database and ase, In other words, «computer program used to manage and query a database is kno, of shams to acoess that lh 4s database management systems (DBMS), They ave designe! to maintain hgge volumes of data. Management ga ineobves: + Defining structure for database storage + Proviching mechanisms for data manipulation such as addition, modification and deletion of data + Proving data security The primary objective of a DBMS isto provide an environment that is both convenient and efficient for use of available tntormation, DBMS are designed! to manage large antount of information, The term manage means to define structure, for the shortage of information anil to provide mechanisms for its manipulation. A DBMS must also provide thesafy jot the stored information despite systemt crashes or unauthorized attempts to corrupt the data. In data sharing by various Users. the system must avoid generation of rests, Uhe first database: management system was developed in 19605, by Charles Bachman, Bachman’ aim was to make more effective use of new direct access storage devices. Until then, the processing has been based on punched cards and which means serial processing was dominant, Network model was developed by CODASYL based on The baste idea of DBMS is that, all the data is kept centrally and only the authorized users can acces ugmetic tap Bachman’ ideas. the data The database management system allows you to do the following. ed in tabular form in such a way that the tables may be linked together. 1 The data is arr The overall structure ofa DBMS Dae Revont ] Record [Record } Database Management System} » a Database Management System The users can put queries to search data to meet certain criteria, The addition of more data, the deletion and editing of existing data access to each of the Lables, 4. Aeration to the structure of data files on tables. 1 the database from other packages and data to be transferred to another package Only authorized people « ta 6 The user can import Relational Database Management System (RDBMS) (RDBMS) isa program that lets you create, update, and administera relational eee A relational database management syst : = This a database ma [e Information Technology - 10 d gement system (DBMS) that is based on the relational model as introduced by E. F. Codd. Most popular commercial and open source databases currently an use are based on the relational database model A short definition of an RDBMS may be a DBMS in which data ts stored in the form of tables and the relationship amon the data is also stored in the form of tables, and the p among . Advantages of Database ” The advantages of a centralized database are given below Data Redundancy: In a database, particular information is stored centrally at one place. Redund: ft 4 centrally at one plac edundancy on icity is considerably reduced a + duplicity pr Renove Inconsistency: In a conventional data processing system each program has its own data files. The same information may be stored in diferent files, This because the files might have been updated by diferent users at different times. The problem of inconsistency is removed if the database is centrally administered Pata Sharing: Ina centralized database, the basic data is stored in one format but the way of interpretation of data tor different end users is different. So, you can say that different users can share the same data visualizing tin their sem way [AC Better Security The user cannot corrupt he data, creating problems for others. The DBA has a complete control over the database. He ensures that access to database is only through permission of the competent authority. The users of the database can be divided into different categories. Some of the users may be given authority to read and ‘use the data, others may be given authority to update data or delete records. Consider an example of a bank where the employee at different levels may be given access to different types of data in the database. A clerk may be given the authority to know only the names of all the customers w! ‘ho have a loan in the bank but not the details of each loan the customer may have. It can be accomplished by giving the privileges to each employee. This provides high curity to the data and also privacy of data vio Integrity: Lets take an example ofa database that contains marks scored by a set of students in an examination ‘The maximum marks are 100. The marks secured by a student cannot exceed 100. Integrity checks can be inbuilt into the system such that database will accept numbers only in the range of 0 to 100, as marks secured by the student. For any field in a record the validity of the data may be checked by inbuilt routines integrated into the A “Gystem. This provides integrity to the data. %, Data Independence: Different users can view the data in different ways and also DBA can change storage structure _Aithout affecting the existing applications 7 Easy Enforcement of Standards: With centralized control of the database certain applicable standards can be followed in data representation, These standards may be a company’s own standards, or they may be national or _Anternational standards Provides Backup and Recovery: Centralizing a database provides the schemes such as recovery and backups from the failures including disk crash, power failures, software errors which may help the database to recover from the inconsistent state to the state that existed prior to the occurrence of the failure, though methods are very complex. Info Byte — Data inconsistency is often encountered in everyday lie, Consider an example, you have all come across situations when a new address is communicated to an organization that you deal (For example, Telecom, Gas Company, Bank). We find that some of the communications from that organization are received ata new address while other continued to be mailed to the old address. How can this inconsistency be avoided? Combine all the data in database would involve reduction in redundancy as well as inconsistency. Moreover, iti likly to reduce the costs for collection storage and updating of data + Disadvantages of a Database 1, Complexity: Database systems are complex, difficult and time consuming to design. The design of a distributed database has to consider fragmentation of data, allocation of fragments to specific sites and data replication. Database Management System (OpenOffice dBase) ~~ Additional database design work must also be done to account for the disconnected nature of the database oy _ sample, joins become extremely complex and expensive when performed across multiple systems, 2-~ Economics: Substantial hardware and software start-up cost. Extensive conversion costs in moving from a file. _based system toa database system ~-S Security: Remote database fragments must be secured and fthey ae not centralized then the remote sites MUStbe secured. The infrastructure must also be secured; for example, encrypting the network links between remote ste, a _A~ Difficult to Maintain Integrity: Ina distributed database, enforcing integrity over a network may require too much of the network’ resources to be feasible ‘Training: Initial training required for all programmers and users. Users of a Database Management System Users of a database management system may fallin any one of the following categories: 1. End users 2. Application programmers 3. Sophisticated users 4. Special users 5. Database Administrator (DBA) 1, An end user is not a trained person but uses database to get responses of his queries. For instance, an accountant ‘can query the database to check if any loan is outstanding against an employee. But he is not authorized to make any modifications to the database. 2. An application programmer can interact with the database through application programs. For instance, the establishment section of an organization (its the department dealing with employees) can interact with the database through application programs for generating the payroll of the employees. — < ae a) User 1 ‘Application Program 1 )«- | > ee smear ae) Database User 2 ‘Application Program 2 }«——> User 3 [ Application Program 3 }* eT { Application Program 4 }¢— Components of DBMS iH 3. A sophisticated user interacts with Database Management System (DBMS) by forming his request in a database query language 4. A specialized user can write specialized database application programs. The specialized softwares may include computer-aided design (CAD) systems, knowledge base expert systems etc "The database administrator (DBA) is responsible for overall control of the database. Sometimes a team of experts is given the responsibility of DBA. A DBA needs a number of utility programs to achieve the tasks of deciding storage structures, access strategy, leasing with other users, defining authorization checks defining strategies for backup and recovery etc. Definition Byte— Database: A collection of logically related data to meet the information needs of one or more user. Database Management System (DBMS): A computer-based collection of inter-related data called database and a set of programs to access that data emeto clay Notepad C The term database can also be defined as a collection of records stored in a computer in a systematic way 9 that a computer program can consult it toamiwerquelone & Acomputer program used to manage and query a database is known ax database management system (DBMS) The first database management system was developed in 1960's, hy Charles Bachman. © Alana database management stem (RDBMS) progam that el you cent, pae, and administer aetna database. 4 _Itisa database management system (DBMS) that I ased on the relational model as introduced by P.#. Cod 4 RDBMS may be a DBMS in which data Is stored in the form of tables and the relationship armong the data is aly stored inthe form of tables, 4 Theadvantages of a centralized database ar: data redundancy; removes inconsistency; data sharingz better securlty lata integrity: date independence 4 Easy enforcement of standards; provides backup and recovery 4 Users of a database management system, End users, Application programmers, Sophisticated users, Special users, Database Administrator (DBA). Assignment: Q1.What isa database? ‘Ans. Database is a collection of data (information) related toa particular organization, (Q2.What are the advantages of database? ‘Ans. The advantages of database are: (Data Redundancy (ii) Removes Inconsistency (ii) Data Sharing (iv). Better Security (¥)_ Data Integrity (vi) Data Independency (vii) Easy Enforcement of Standards (Q3.Name the different types of users who work with a database. ‘Ans. (a) End users (©) Application programmers (©) Sophisticated users (4) Special users (€) Database Administrator (DBA) (4. What is data redundancy? Why it leads to data inconsistency? Explain with an example. ‘Ans. Data redundancy is the storage ofthe same data in more than one file. This leads to data inconsistency. This a because the same data might have been entered by different users at different times or it might have been updated by different users at different times, For example, the address of students in an educational institution may be stored inthe student’ section of the institution Some ofthese students might be residing in the hosel ofthe institution, Their addresses may be available in the hostel as well Suppose the address ofa student is changed, Ii possible thatthe change in addres is entered inthe file maintained in the hotel. But the same may not be updated in the ile ofthe student section, Thus, duplication may lead to inconsistency. (Q5. What isthe purpose of using a database/Database Management System? ‘Ans. Database is an organized collection of related information. It consists ofall types’ data, enabling you to organize, sort and calculate data, Database offers much more comprehensive function for manipulation of data that a spreadsheet software. Assessment, ‘A. Fillin the blanks 1. The first database management system was developed in 1960's by... 2. Network model was developed by. based on Bachman’ ideas 3. database management system (DBMS) that is based on the relational model was introduced by Database Management System (OpenOffice dBase) An «an interact with the database through application programs. 5. The Is responsible for overall control of the database. B. Answer the following (short answer) questions: 1 What is DBMS? 2. Define the following terms: a. Database b. DBMS (Database Management System) 3. How is database management system useful? Answer the following (long answer) questions: |. What is the idea behind DBMS? 2. Explain the need of DBMS. 3. Explain the advantages ofthe Relational Database Management System. 4. Briefly describe the users ofa database management system. Answers, ‘A. 1.Charles Bachman 2.CODASYL —3.E.E.Codd 4. application programmer 5. database administrator 2 Create and Edit Tables Using oe and SQL Commands In this Lesson . 5 Creating a new database Structured query language (SQL) and data ‘Organization of database definition language (DDL) commands > Creating database tables > Functions of SQL Using the wizard to create a table Data manipulation language (DML) Creating a New Database To create a new database, follow the steps: ‘Step Click the arrow next to the New icon. In the drop-down menu, select Database. This opens the Database Wizard, You can also open the Database Wizard saagmaqg using(Flle @ New Database. The firs step of he Database Wizard has “The first ep oF the Di Wizard h: ‘one question with two choices: 1 “oMtd Dyas Database Wizard (e Information Technology - 10 Step 2: Select Create a new database and then click Next ‘The default choice for the first question is Yes, register the database for me and the default choice forthe sevond question is Open the database for editing Step 3: Select any choice and click Finish Step 4: Save the new database Organization of Database The hierarchy followed in any database: Database File, Table, Record Field, Data-type Database File: This is your main file that encompasses the entire database and that is saved to your hard. ‘StudentDatabase.mdb Table: table is a collection of data organized into records and fields about a ina databas For example, a school database may consist of specific topic. There can be multiple tables Table #1) Students Table #2) Teachers ‘The table will contain information related to teachers and students’ personal details, salary for teachers and grades for students. Observe that the two tables have information about specific topic. Record: A record is a collection of facts referring to single entity object of a person. referred as tuple. _\ > Field: Fields are the different categories within a table. T: column, For example, ina Stident database's resented as 2 row and bles usually contain multiple fields. It is represented as a iVinclndes elds such as: i . A sid + St lastname Ts firstname A vate_of birth + gender © address x Nata types: Data types are the properties of each field. field only has I data type.) + stidas Number data type Eee ae + stJasiname ,st_firstname as text data type TABLE I Base Data Types Understanding Field Data Types When computer stores data in variables, each variable needs tobe assigned a data type The datatypes in Numeric Type 'enOffice Base are as follows Name Date type | No. of Bytes Signed Range _-ABOOLEAN boolean 1 no le Oorl PTISYINT Integer 1 no 010255, | ASMALLINT Integer 2 yes -2t0 21 [INPEGER T Integer 4 yes 2021 BIGINT Integer 8 eee Database Management System (OpenOrfice dBase) (Max Scale, Max Precision) NUMERIC number solint | yes Max Scale = unlimited 7 | i | (Max Scale, Max Precision) DECIMAL decimal no limit yes: ‘Max Scale = unlimited Max Precision = e*""" REAL | real | 4 yes 21 to (2-25)*20 a == t a a = — FLOAT float 4 yes. | 280 to (2-25)"21 DOUBLE double 4 yes 2% to (225) Alphanumeric Types 7 ‘Name Datatype | Maxlength | Stores up to the max number of characters LONGVARCHAR text | 2GBfor32bitOS | indicated by user. It accepts any UTF 8, Le - character. Stores exactly the number of characters | CHAR text (x) | 2GBfor32bi0S | specified by user Pads with alin space fr | | shorter strings. Accepts any UTE 8 characte. Stores upto the specified number of characters. | VARCHAR text | 2GBfor32bitOS |, adding (Sane as long varchar) | stores up the specified number of characters. | VARCHAR_IGNORECASE text 2.GB for 32 bit OS_| Comparisons are not case sensitive but stores} L | capitals as you type them. | Binary Types z —+—— 4 Name Data type Max length Description 7 1 ; “yc Stores any array of bytes (images, sounds et) LONGVARBINARY image | 2GBfor32bit OS | Novation quired | | BINARY binary(ix) | 2GBfor32 it os |Stres any array of bytes. No vdiaason | required. VARBINARY binary | 26Bfors2vitos. | St aay array of bytes No vadaton required. Date Time | Name Description Format Date ‘Stores month, day and year information | 1/1199 to 1/1/9999 | Time Stores hour, minute and second info _| seconds since 1/1/1970 | _ Timestamp Stores date and time information Information Technology - 10 Creating Database Tables —— a = |p ieee mm oe me Ina database, a table stores information in fields. For example, a table can hold an address book, a phone book or a price list. A database can have from one to several tables. To work with tables, click the Tables icon in the Database list. The three tasks that you can perform ‘ona table are in the Task List & Keyboard Shortcut { Press Alt + A, to work with tables Creating Tables Using the Wizard to Create a Table ‘The Wizard allows the fields of the table to come from more than one suggested table. We will create a table with fields from three different suggested tables in the Wizard. Click Use Wizard to Create Table. This opens the Table Wizard. Step 1: Select fields. ‘Youhavea choice of two categories of suggested tables: Business and Personal. Each category contains its own suggested tables from which to choose. Each table has a list of available fields. Selecting Fields 2: Click Next. Below the Selected Fields list are two buttons: one with a +, and one with a -. ‘These buttons are used to add or to remove Order of Fields fields from the Selected Fields list. Database Management System (OpenOffice dBase) _ Structured Query Language (SQL))and Data Definition Language (DDL) )Commands eel : as The strengths of SQL provide benefits tor all types of uscrs, including application programe alabase administrators, managers and end users. The purpose of SQL. is to provide an interface to a relational database such ay Oracle Datahase and all SQL statements are instructions to the database. In this SQL differs from general purpose programm language ike C++, The features of SQL are the following @4 -feotyes Sart 7” li processes sets of data as groups rather than as individual units 27 We provides automatic navigation to the data 27 Wuses statements that are complex and powerful individually, and that therefore stand alone 47 Its a common language for all relational databases. In other words, it is portable and it requires very few modifications so that it can work on other databases. SQL lets you work with data at the logical level. You need to be concerned with the implementation details only when you want to manipulate the data. For example, to retrieve a set of rows [rom a table, you define a condition used to filter the rows. All rows satisfying the condition are retrieved in a single step and can be passed as a unit to the user, to another SQL statement, or to an application. You need not deal with the rows one by one, nor do you have to worry about how they are physically stored or retrieved. It is thus a non-procedural language, because more than one accessed rather than one record at a time. SQL provides statements for a variety of tasks, including: © Querying data a record can be Creating, replacing, altering, and dropping objects + Inserting, updating, and deleting rows in a table + Controlling access to the database and its objects + Guaranteeing database consistency and integrity Functions of SQL Functions of SQL are: er Retrieve data © = Modify data Store data In a database, you can define the structure of the data and manipul + Delete data © Create tables and other database object © Delete data ate the data using some commands. Manipulate ‘means the you can add new data, update the current data, delete the data or reviewing the data from the database To do so, there are two types of languages for this task + Data Definition Language (DDL)_) Info Byte The other two types the commands SQL supports ae _Data Definition Language (DDL) Data De Common DDL statements are + CREATE ~ Creates new database or table Transaction Control Language: commit, savepoint, rollback commands tion Language (DDL) is a standard for commands that deli of Commands that help in detning region, deleting Tetations, «resting indices, ai aioxhly ng relation s © CData Manipulation Language (Di y the SLuuctures ina database It consists hemey 2) 2) ALTER Modities the structure of the database Database Management System (Openorfice dBase) [B. oN & DROP ~ Deletes the database/table ' } RENAME - Renames the database/table Data Manipulation Language (DML) DML is also a part of SQL and is used for manipulating the data in database. It consists of commands that help in retrieya, insertion, deletion or modification of data in the database. It is to provide efficient human interaction with the system Common DML statements are: 4 SELECT - Retrieval of information from the database + INSERT - Insertion of new information into the database + DELETE - Deletion of information in the database + UPDATE ~ Modification of information in the database There are two types of DML: + Procedural: The user specifies what data is needed and how to get it. Non-procedural: Theuseronlyspecifieswhatdataisneeded. Itiseasy fortheuserbutattimesmaynotbeabletogenerate code as efficient as that produced by procedural languages. It is used to specify complex database operations. Info Byte 7 f. popular data manipulation language is Structured Query Language (SQL). Its used to retrieve and manipulate data in 4 relational database (RDBMS). Other forms of DML are those used by IMS/DLI, CODASYL databases, such as IDMS (integrated Database Management System) and others Create Tabie Command A table or relation can be created in a database by CREATE statement bf SQL. Unlike C++ SQL is not case sensitive. You can write the keywords or field names in lower case or upper cas¢ letters. In SQL TABLE, Table and table mean one and the same thing. For clarity, we will write all SQL Keywords in capital letters. The format of CREATE command is: CREATE TABLE table_name Cgrxyotn == — (column_name1 datatype, column_name2 datatype, column_nameN datatype) + table_name - is the name of the table. + column_namel, column_name2....- is the name of the columns ‘+ datatype - is the datatype for the column like char, date, number etc. For Example: If you want to create the employee table, the statement would be like, nber u The above command creates a table named employee with the following fields: pee ‘Type of data a Numeric 5 digits name Character string 20 characters long sag Character string 10 characters long a Numeric 2 digits salary Numeric 10 digits ita Character string 10 characters long & 0) information Technology - 10 Info Byte a ‘Command to view the table's structure If the user wants to view the structure ofthe table, the view command will help to achieve the same Syntax: desc ) Suppose, in the above student relation we want ta add one more column with attribute hobby. It can be done through the following statement: ALTER TABLE STUDENT ADD (HOBBY CHAR (6)); (4 : ‘The above declaration adds a column hobby to the relation student which has already been created. Another example of using ADD clause you can add a new column into the table. At FER TABLE STUDENT 29) ADD (AdmnNo number(10,0)); \ 3 ) TRUNCATE TABLE Command If there is no further use of record stored in a table and the structure has to be retained then the records alone can be deleted. Syntax: a sunctor TRUNCATE TABLE ; > !f TRUNCATE TABLE STUDENT, -—+% + } ‘Truncate command will delete all the rows from student table. DROP TABLE Command Aable can be simply. deleted using DROP TABLE command. )But, it is required the table should be empty before any attempt is made to drop it. The format of this command is: be DROP TABLE « table_name > For example, relation student can be dropped with DROP TABLE student; only owner of the table can delete it with the DROP TABLE command, Database Management System (OpenOffice dBase) [B271 > a GQ OL SELECT Command SQL allows the user to make queries on the database with the help of SELECT command. A query is a command useq to extract certai information from the database relations)SELECT command can be used to retrieve a subset OFrowy,, cGlunins from one or more tables. The general format of a SELECT command is as under: Sy SELECT [DISTINCT] [ [WHERE] } Where. [SELECT is a SQL reserved word. DISTINCT isa SQL keyword used to eliminate duplicate rows from the query result. | is the name of column to be projected. [FROM is a reserved word —___| isa relational expression Let us consider the following relation for answering some queries through SELECT command: Trainee St-Name Id_no Course ‘Age Marks DOB [Suresh 102 T™. 4 85 Raj 101 cD 15 90 20-05-81 Mohan 104 ™ 14 91 10-07-79 Neelu 105 ™ 13, 90 05-05-81 Monu 106 BP 16 95 07-08-80 Deepu 107 ™ 16 86 09-11-82 For viewing just two columns i.e., name & age in the above relation you would write the SQL statement: SELECT NAME, AGE FROM TRAINEE; <5: ‘The above statement will give the following output: NAME AGE Suresh 4 Raj 15 Mohan 14 Neelu 1B Monu 16 Deepu 16 For viewing all the columns of the relation we don’t need to. make list of all the attributes of the relation. Instead asterisk (“can be substituted for the complete list of column attributes,/The following command will list all the columns °! relation Trainee - 7 SELECT * FROM TRAINE] 1i we project some column (3) of @ relation using, duplicate entries in the result, for example: \e2 Information Technology - 10 nany LECT Command then there i lity that there are ™ — SELECT Age FROM TRAINEE, (€4 Produces the following output AGE 4 15 4 1B 16 16 16 ‘The duplicate entries can be eliminated using DISTINCT keyword as: SELECT DISTINCT Age FROM TRAINEE; ( €4 ‘The output ofthis query will be: Age 4 ‘fin the place of DISTINCT, we give ALL then the result retains all the duplicate values. Thus, itis just the same as when we neither specify DISTINCT nor ALL. In this way, we can say ALL is not an argument but just a qualifier. — Sheer Command ‘The INSERT command is used to append a row or tuple to_a table. The syntax of the command is: INSERT INTO VALUES (,...) Aysafor Where, rel_name is the relation name val_kis the value ofthe kt For example, the following command will append a row into relation student: INSERT INTO Trainee VALUES (‘Ram, ‘CD, 110, 17, 86,"17/8/90'); UPDATE Command. ‘This SQL statement is used to change column values of a particular row. The row is normally selected using WHERE clause and the columns within that row are set to new values using the SET keyword./Format of the statement is : UPDATE SET f = WHERE ; Where, \#e_name is the name ofthe relation __altr_name_kis the name of the kth attribute ~-tiéw_val_k is the new value to be asigned to attribute k For example, to change marks of Mohan to 85 we would write the statement as: Datatase Management System (OpenOffice dBase) UPDATE trainee SET mark WHERE trim(name) = “Moh Similarly, to change Mohanis marks to 85 and his course to "M>" the command may be written as UPDATE Trainee SET marks = 95, Course = "MP" “) L WHERE trim (name) = ‘Mohan - S DELETE Command This command is used to delete one or more rows which can be selected for deletion using WHERE clause. Individua attributes of a row cannot be deleted using this statement. The format of the statement is: DELETE tel name> Cpecho> DELLE FRom
wHeoe WHERE (Condition>); LeeNDIT EN) For example, complete record of Mohan can be deleted from Trainee relation using the statement: ) DELETE trainee Delete Pamn tocus-4 Ley WHERE Name = “Mohan’s AC Vobays Definition Byte — ‘Table: A table is a collection of data organized into records and fields about a specific topic. Record: A record is a collection of facts referring to a single entity, object or a person. Field: Fields are the different categories within a table, Tables usually contain multiple fields. Notepad %& Structured Query Language (SQL) is based on Relational Database Management System (RDBMS). Among commonly used tools of Oracle is SQL. 4 SQLis non-procedural language and moreover it is a common language for all relational databases. SQL has simple commands for querying, inserting data or deleting data and updating. & —Tocommunicate with the database SQL supports the following commands, & Data Definition Language: create alter, truncate, drop commands. ‘Data Manipulation Language: insert, select, update, delete commands. ASSIQOIOCN 1. Distinguish between DDL and DMI. ‘Ans. DDL stands for Data Definition Language. It is used for creation of tables whereas DML stands for Data Manipulsto® Language and is used for put values or update tables. 2. Write SQL command to use relation Trainee and give alist of students: (A). Who scored either 85 or 86 marks. (B) Whose age is 16 years and who got 85 or more marks. (C)_ Who scored marks lying between 85 and 90. ‘Ans, (A) SELECT Sname FROM Trainee WHERE (marks = 85 OR marks = 86); Information Technology - 10 - anoverthe flowing (long answer) questions: | Whats the purpose of data manipulation language? Give example Give format ofthe following SQL commands: : 1 (Create table (iv) update i) Selec : “ : (delete wi (inser (wi) drop table 3 Write SQL command to display the name of employees who joined inthe year 2020. 4 Create a view named EMP_SALES containing the employee numbers, names and salaries of all employees for Deptno=2 answers beable 2.column/field 3 4.0df 5. database wizard 6.Tools, SQL 7. blue 8, INSERT 9. DELETE 10. UPDATE. 1 ALTER TABLE 12, DROP TABLE BAT 27 3.7 4F 3F Perform Operations on Table In this Lesson-- ~ ee 4 Insert records in the table 4 Relationship between tables & Delete record 4 Deleting a relationship Sorting data Letus insert data, edit records, delete records and sorting data in the table. Insert Records in the Table ‘You can insert data into table for database in two ways: : JC Datasheet View: This option is very simple and easy to insert a record } Taro Views on opines yee Z SQL View: This option provides a command to insert a record. bare, Datasheet View Toinsert data using datasheet view, follow these steps: ‘Step 1: Open the database and select the table to insert | [6:o Refresh Table option to see the updated table, | *c™* ucety ee 1 Edit records in table You can edit any records in two ways like datasheet view and SQL ‘command. ‘To edit records in Datasheet view, follow the steps: ‘Step 1: Open your database to edit table. Step 2: Select your table and double lick om it to open it. {ow place your cursor on the record which you want to edit Click on Edit > Edit Data or click on edit icon available on the standard toolbar or double click on data you want to edit ‘Step 5: ‘Type the new data as you per requirement. Step 6: Save your records. To edit records through SQL, follow the steps: fen Execute SQL statement window. and type following command: 100 where" CollectionID'=45 fipdate "CD-Collection ” set Collection ID’ ‘The update command is used to edit records through SQL. command. Delete record To delete a record in datasheet view, place your cursor on the record in the table and do one of the following: Click on Edit > Delete Record option. It will ask your confirmation 1o delete selected data with “Yes"/“No” button. Or right-click and select delete option. Select the entire row, do right-click and choose the option Delete Rows e- tnd dick on “Yes” button to confirm deletion, ne ‘To delete a record using SQL. view, follow the steps: et Suep 1: Open Execute SQL statement window and — ieee eae Deteting a Record . Ze the following command: AAbcleve trom "CD Collection” where “Collection” 100 paeren Common Field Properties [9 »-2mam cocamon Conde te Woe Gn - | (Yow To dor ey Field properties are useful to restrict or enable data validation in the table. Data Validation referstothesetofrulesand | regulation for data input. So that incorrect [|atumnte tet vatnan il data or invalid data can be avoided in the Ficaece mage TEAR F table. enccanyo wage Nee) To change the properties, follow these steps: Step 1: Open your database and select the table to change the properties. Step 2: Right-click on a table and select edit option or Click on Edit > Edit option. That opens the table in design view. Table in Design View ‘Step 3: Now select the particular field to change the properties. Ce Prope O30 are as following: ‘AutoValue: It provides Yes/No type option to accept the value automatically at the time of insertion. Entry Required: It is also Yes/No type option to make the field value mandatory at the time of insertion. Length: This option is used to specify the total length of the selected field. a Default Value: This option provides a default value to your field if value is not inserted. Format Example: It allows to set your own format for the field values like email format, zip code format etc. Sorting Data ‘As you know that sorting rearranges the data in an ascending or descending order. ‘To sort data in OO Base, follow these steps: (© co- New Relation | Step 2: Dragand Drop © Drag Primary Key column to related column into the another table. Follow the below given steps to create relationship in OO base. Step I: Click on Tool > Relationships. A new | window appears to add tables in the relationship. Step 2: If tables are not available, click on Insert = ‘Add Tables option or click on Add Tables = icon on the taskbar. Step 3: Click on Insert > New Relations. A new window appears to select the Tables, fields, update options, and delete options. Select appropriate fields and options then click on the OK button. If you want to create a relationship using drag and drop, click on the field ofthe primary key of one table and link them with the foreign key of the child table ‘When you add a relationship, the relation design window show one line that connects your tables. ea Information Technology - 10 ‘Adding Tables Deleting a Relationship ‘To delete a relationship using one of the following: Click on connecting line and press the Delete key. Or click on connecting line and right click, then select Delete option. Wn, B yb $a ( Edit relationship i quite similar to delete relationship, click on connecting lines and do rightclick on table and select Edit \\ option. Notepad 6 ‘A relationship between the tables is established by matching data in the key fields which are mostly the Primary Key ‘which uniquely identifies each record ina table and a Foreign Key inthe other table. between tables allows the data from tables to create queries, forms and reports “The primary key of another table is referred as A refers to an association or connection between two or more tables. L 2 3. The is used to maintain accuracy and consistency of data in a relationship. 4 5, The use of relationship in a database will help to the data entry erors. B. Answer the following (short answer) questions: 1, What are the advantages of referential integrity? What are the types of relationships? What are the ways to create relationships? Write steps to edit the relationship. C. Answer the following (long answer) questions: 1. What do you mean by referential integrity? 2. How to remove. relationship? 3. The relationship between tables which hep to link data with speci conditions, Explain the statement. Answers: ‘A. 1.Relationship 2. Foreign key. 3. referential integrity 4. relationship 5. reduce Apply Answer the following application/competency-based questions. A. If there are two entities ‘Person’ (Id, Name, Age, Address)and ‘Passport {Passport_id, Passport_no). So, each person can have only one passport and each passport belongs to only one person, Identify the type of relationship. a. One-to-One Relationship b. One-to-Many Many-to-One Relationship 4. Allofthe options B, Tanisha wants to use the field from the two tables. Which feature of OO Base will she use? a Table b. Relationship © Query 4. Form Database Management System (OpenOffice dBase) © Inthe gven elation which ey actas fen bays Castomet Order Product while referring tothe respective table from the ‘Order rier id Producti Customer_id Orders ‘i thle eee cumeest Product mane 2 Customer_id b. Product_id ae Product_id ed © Order d. Bothaandb ae ~ emo obile_no ate Bb cd 7 © : Retrieve Data Using Query In this Lesson - Query creation using the wizard 4 Create Query in SQL View Query in design view ; Introduction os he 4, ror filter data(By running a query, you can retrieve com a From diferent (A query is in general referred as a question or “SreaningiaT information from an existing database tables basis the conditions specified by the user, S 00 Base provides three ways to perform a query: 1. Query using Wizard 2. Query in Deisgn view 3. Query using SQL view Query Creation Using the Wizard ‘As you know wizard is a step by step process to complete a specific task. You can perform query using, wizard in OO Base. ‘The steps are as following: ‘Step 1: Open your database and select Queries from object pane. Step 2: Click on Use Wizard to Create Query option from the Tasks window. _ CL] Use Wizard to Create Query Option Information Technology - 10 Step 2: Select the table and click on Tables option, step 3: Now come to fields row at the bottom |" Se" YE . given table and choose whatever field you need to display in the query results step 4: Ifyou want to use any alias for your fields type name exact below the field name. i Step 5: The next option is table; this is not 1 mandatory when you are working with a [= l single table, | | Step 6: After then move down to the next row to | sort your records, Just select go to the row where you want to sort the records and Creating a Query in Design View selectit uo 88 #8 BES ACE, = —— | Step 7: Next is function, whenever you want to Ere perform calculation or want to use some e functions you can select this option. ko < 3 z = 3 Step 8 Next row is Criterion, which is very = important to display the records according to the criteria. Here you can use the comparison operators like >.<,>=, rete rT a ‘Step 9. Then number of criteria you can add as. [Weame women per the requirements. Pllarttan 4 eee weap sweety ‘Step 10:Save your query and view the results. fanny a The result will be display as: Create Query in SQL View This option allows using SQL command to display the results Select isa type of DML command that allows displaying records from a table, The syntax of Select comm: ¥) 2 }--Select */columns. jst from table_naie where conditions — Database Management System (OpenOffice dBase) re _In the above SQL statement, * select is the command used for data retrieval lum lis is used to specify all columns or specified columns from the table ¢ * from is, keyword specifies the name of the table to the next + table_name is a table from where you want to fetch the records + where is again keyword that restricts your records from the table aczording to conditions ‘+ condition use column name and specifies the column name and criteria There are four ways you can use select query 1. All records 2. All records with limited columns. 3. Limited records with all columns 4. Limited records with limited columns. All records _sienever you want to fetch all record from table you can us this option. The sytax and example ae afin select * from “emp’ All records with limited columns ‘Whenever you want to fetch all records with limited columns from table use specific column names with select clause Consider the following example: A7 select “empeode’,"ename’,"job" from "emp’ Limited records with all columns Whenever you want to access all columns * is used after select clause and to imit records, where condition is used. With ‘where condition some relational operators are used as per the requirement. Specify the column names after select and use where condition to restrict them. / selected "artist", '‘NumberofTracks" from "CD Collection" wh ere "CollectionID The output is: {8 New Database odd C02 - OpenOice Bae: Query Design Fie dt ow et Took dow Hep Be 869 Bw wey | % ao . ee 7 eceeaeeeeenees| zine? a CC) _ 4 A query isin general refered asa question ora request to sort or itr data ) Information Technology - 10 the blanks. {is database object that is used to retrieve/extract data from the table by using some conditions. LA 'sa just drag and drop type facility provided by 00 base to perform a query. RA is step by step process to perform a query in OO Base. 4 is used to type select command. 5, Toexecute the SQL query written in SQL view, you can press key. B. Answer the following (short answer) questions: 1. Define a query. ‘What are the methods to create a query? What isthe purpose of running a query? 3 4, What isthe difference between the query design view and query wizard? 5, What isthe criteria in query design? aswers; AL Lequery 2, Create Query in a Deisgn View 3, Query Wizard 4,8QL View 5.55 Ately ee ae ee A Jain is working 2+ database administrator he needs to write an SQL. query to fetch “FIRST NAME" from Worker table using the alias ame as , Identify the correct query a. Select FIRST_NAME AS WORKER NAME from Workers b. Select upper (FIRST_NANE) from Worker: c Select NAME AS WORKER_NAME from Worker; 4. Select FIRST_NAME AS WORKER from Worker NAMB; , Identify the query fhe wishes to print all Worker details from the Worker table order by FIRST_NAME Ascending a Select all from Worker order by FIRST_NAME asc; b. select * fron Worker order by FIRST_NAME desc; ¢ Select * from Worker order by FIRST_NAME asc; d. Print * from Worker order by FIRST NAME asc? 5: Create Forms and Reports using Wizard In this Lesson. 4 Creating a Form Using the Wizard 4 Searching records using the form ‘Enter Data from Forms Report Modify form 4 Creating a report using the wizard Database Management System (OpenOffice dBase) Introduction Atfinrhor Y foe Form is a database object that allows to view, enter, edit, delete or view a table in an easy-to-understand formals To create a Form, open a table in a database and follow any data in a table. A Form isa representation of dy, ta yy two methods to create a form: © Use Wizard to Create Form + Create Form in Design View Creating a Form Using the Wizard — To create a form using wizard, follow the given steps: Step 1: Click on Forms option available at the database objects pane. ‘Step 2: Click the option Use Wizard to Create Form... in the tasks window. The form wizard will appear. Use Wizard to Create Form Option ea Step 3:.‘The form wizard has 8 steps: ld selection - Select the table or tocceme ie {queries you want to display on the | : form. | Field Selection Option 2. Set up subform - This option allows to show the contents from the table with a separate form. There art two options available for this step: 1. Subform based on the existing relation 2. Subform based on manual selection of fields 3. Add subform fields - This option only comes when you click on Add Subform option to select fields for the subform. 4. Get joined fields - This option also related to subform and appears only when you select Add Subform ophon. 5, Arrange Controls - This option allows to arrange available form conteols. It provides three options like: «+ Label placement - Align Left or Align right, «+ Arrangement of the main form as: Columnar ~ Labels at Left, Columnar ~ Labels on Top. AS Datasheet, In blocks - Label Above wernaten ely 1 i 7 Omni 1 i | | a Step 4: Record that you have searched, will be displayed on the screen. a amon Search Record Using Form Lab Activity ‘Open the database you just created and create a form for the same. Enter data in a table using a form. Which method of entering information you found it easier? (Open the database you just created on academic results Use the select query statement to query and sort on subjects where marks scored was greater than 60%. Create a database of books for a school brary. + Create fields for book title, cost, Author, availability, date of issue et. + Create a form to fill in more records + Use the select query statement to query for books released on a certain dat. ‘+ Take help from your teacher if required. Take a print and record it in your project file Report Introduction o A report is the final outcome of any computerized system Report is a database object-used to display of the data in the desir The red format It is an efficient method to organise, view and present data. We can control the appearance of the report. method to create a report: Use Wizard to Create Report King a report, you can: ‘Summarize the data from the selected table in a printed form, Customize the report as and when required ‘Add header and footer of your choice Apply formatting as per your need ‘Add controls as per the requirements Select queries and tables to create a report Creating a Report Using the Wizard 00 Base provides a way to create report using wizard. As you know a wizard is step by step process of creating objects in OO Base, Database Management System (OpenOffice dBase) C>. >» ( st . e\2/ Web Applications and la\- Security AP inthis unit 1, Working with accessibility options 6. Using offine blog editors 3, Networking fundamentals 7. Online transactions 4. Introduction to instant messaging 8 Internet security 4. Chatting with a contact - Google hangouts 9. Health and workplace safety 5. Creating and publishing web pages ~ blog 1; Working with Accessibility Options In this Lesson. 4 Understanding special needs + Keyboard 4 Launching accessibility options 4 Mouse settings Narrator 4 Set up color and high contrast 4 Magnifier Understanding Special Needs When all the users, regardless of their disability (special needs) are able to use a computer system, itis referred to as omputer accessibility. Accessibility features are designed to help specialy-abled (people with disabilities) use technology ‘asly, Most of these features require special software, but these days many are built into the operating system of your computer or mobile device. For example, W Windows 10, Android and Apple 10S support text-to-speech ature that reads textaloud for people with limited or low vision, ‘while a speech-recognition feature allows users with limited mobility to ‘onirol the computer with voice commands. Following is an indicative list of different types of disabilities that can affect computer accessibility “A Viel impairment: Blindness low sion andlor ipdnes. = Blind people rely on hearing and touch to use computers. People with low vision may be able to read text and ditions for example, very large fonts, high contrast, but usually also rely on other senses, Color blindness is’ the inability to discriminate. differences in colors, mostly between red pictures under specific com such as hearing and touch. and green. _/®- Motor or dexterity impairment: Total absence, oflimbs or digits, paralysis, cerebral palsy, instability or pain.n the use of fingers, hands, wrists.or arms Individuals with motor impairments main the mouse. Hearing disability: From slight loss of hearing to total deafness. People with hearing impairment communicate using sign and written language, while a few may rely on lip-reading and hearing-aids. AC Cognitive disability: Mental retardation, language and learning disabilities (e.g, dyslexia) head injury and stroke, Alzheimer's disease (i.e. memory retention problems). Iy face difficultiesin using standard input devices, the keyboard and Web Applications and Security People who find difficulties in the performance of mental tasks. These can range from limited and focused problems aflecting a very: specific cognitive function (eg. the ability to understand math), where the individual is unable to Lake care of daily living activities. & Speech impairments: Speech impairments are quite rare and sometimes are combined with other disabilities but they do not indicate limited intelligence. Individuals with speech impairments may have articulation problems (e.g., stammering), be unable to speak loudly ‘or clearly, or even to speak at all. Obviously, they have problems in using speech recognition systems. Depending cation aids, to substitute speech. on the severity of their case, they may use comm: {~ Iliteracy: Illiteracy is the lack of ability to read and write in any language. Although illiteracy is not a physical disability, it creates considerable blockades to computer accessibility and is ‘often treated in the overall context of computer accessibility. Assistive technology enables a specially-abled person to use a computer a combination of hardware and software Launching Accessibility Options The Accessibility settings in Windows 10 can be activated in different ways: 1. From Settings (eee Step 1: Click Start button > Settings. secon Windows Setting screen appears, Windows Setting Screen @ etme ce © tase of ces teybous ating | © Le windows sung tase of Rte Step 2: Click Ease of Access option. “oe 2. From Search Option Step 1: Click the Search button. In the text box type, Ease of Access. You will be shared with the list of Best match options. List of Options Information Technology - 10 3, From Login Screen suep I: The ease of Access button is also available on the bot ‘or Login screen. ‘om tight of the Magner Once you select the option, the following screen will appe oveenionees on = If your computer is equipped with speakers you will hear the Windows Narrator reading the options inthe lst. This enables the specially-abled to set up the system as per his/her requirements. Login Screen 4, From the Keyboard Hold down the Windows | gg — Logo key and press U 4. Norator key. I will also open up | ;-—— eae nua vanesoen the Ease f Access Center [Ome ee | window. ia Sevens “ Finally, you will reach to | « se So the following Settings | cwasnom sxpeoenenn oe window with any of the |e ones i methods used. © aan ene Notice the vi oe : options you are provided |v = - with on the left side =f. of the window. Let us | — understand each option ae one by one. a Ease of Access > Narrator Narrator = j)% Narrator js a screen-reading app. It reads on-screen text aloud in a few applications and programs, Use Narrator to tse your computer without a display or mouse, to read and write email, browse the Tnternet, use apps and work with documents and to complete common tasks. The following settings are available on the Narrator window: . describes on-screen activity aloud, + Allows Narrator to open every time you start Windows. Narrator: Reads content and * Start Narrator automatically: + Choose a voice: Select the voice you want Narrator use * Speed and Pitch: Adjust the slider bars to control the speed and pitch of Narrator. * Intonation Pauses: Click the toggle swt + Read hints for controls and buttons: Hear information about how to interact with items such as buttons or slider bars, or additional information. :nables Narrator to a ich to turn this feature on or off. Some voices do not support this setting nnounce the individual keys you type, Characters you typ ™~ * Words you type: Enables Narrator to read the words you type, + Lower the volume of other apps when Narrator is speaking: Lowers the volume of other apps when Narrator js speaking, + Play audio cues: Plays audio cues when you perform certain actions. ‘+ Highlight the cursor: Highlights the selection that Narrator is reading in a blue box. ‘+ Have insertion point follow Narrator: Hear text read aloud as itis typed in applications such as Notepad op Microsoft Word. By default, when you drag your finger across the touch keyboard while using Narrator, it announces the keys that you are touching. When you reach the key that you want to type, double-tap that key o type the character. + Activate keys on touch keyboard when [lift my finger off the keyboard: Type by pressing the keys on the touch keyboard once. + Braille (beta): Enables Narrator to work with a braille display. Magnifier -12/, Use Magnifier options to [= a increase the size of te eS ager images or change the way items, meee emen ne tgn display on the screen. Enlarge |. oc the full screen, the area around | 5... Ore the mouse pointer, oF just 2} wo f= part of the screen. You can als0 | snpune follow Narrator around the |e cum —— screen aS a — On the Ease of Access menu, 0 sw Deeparsee click Magnifier, and then turn | » ow. Cisse naman nt, ‘on Magnifier. | aces Dimcennwoonece ‘The Magnifiertoolbardisplays. |__ Ease of Access > Magnifier Info Byte — (you open Ease of Access before you sign in, Magnifier automatically turns on when you select Magnifier Modes ‘Select Full screen, Docked, or Lens view. + Full screen enlarges the entire screen. + Lens enlarges the area around the mouse pointer. + Docked enlarges part of the screen. Keyboard Use On-Screen Keyboard, Speech Recognition and Dictation to use the computer without a mouse or keyboard. On-Screen Keyboard On-screen keyboard is a visual keyboard that opens on your screen and takes the place ofa physical keyboasd) You can type using a mouse pointer or joystick. I you have a computer with a touch screen, you can also type using a sf mouth stick or your finger. In Ease of Access menu, click Keyboard, and then turn on Use the On-Screen Keyboard.

You might also like