10th class 402 book notes VIRESH (1).pdf
Document Details
Uploaded by AffirmativeJacksonville1297
Tags
Full Transcript
CHAPTER 8--Introduction to Database Management System Data and Information:-The raw facts constitutes data. The facts may be related to any person, place, activity or things. It may be stored in the form of text, graphics, audio or video. Information is the processed or organized...
CHAPTER 8--Introduction to Database Management System Data and Information:-The raw facts constitutes data. The facts may be related to any person, place, activity or things. It may be stored in the form of text, graphics, audio or video. Information is the processed or organized form of data. If data is not correct or accurate, the information obtained by processing such data may not be correct. Databases and DBMS:-A database is a collection of logically related data items stored in an organized manner. The information being stored in a database can be added, modified, deleted or displayed according to the requirements of the user. The software that is used to create, update and retrieve data is known as database management system (DBMS). Some of the common examples of DBMS are MS Access, Open Office or LibreOffice Base, Oracle, Ingress, MySQL. Advantages of DBMS: 1. Organized Storage. 2. Data Analysis. 3. Data Sharing. 3. Minimal Data Redundancy. 4. Data Consistency. 5. Increases Efficiency. 6. Increases Accuracy. 7. Increases Validity. 8. Security. Data Models:- A database can be designed in different ways depending on the data being stored. This structure of database is known as data model that describes the manner in which data will be stored and retrieved. There are different data models such as hierarchical data model, network data model and relational data model. Relational Database Terminology:- Let us get familiar with some of the common terms used in RDBMS. Entity – It is a real world object about which information is to be stored in a database. Eg. Student in a school. Table – A table is a collection of logically related records. It is organised as a set of columns, and can have any number of rows. A column represents a field or an attribute while a row represents a record. Field or Columns or attributes – A field is the smallest entity in the database. A collection of fields make a record, a collection of records make a table and a collection of tables make a database. Data Values – Data values are the raw data represented in numeric, character or alphanumeric form. Record or Row – The data values for all the fields related to a person or object is called a record. A record holds the data values of all the fields for a single person or object in a table. Primary Key – A primary key or simply a key is a field that uniquely identifies a row in a table. The column or combinations of columns that form the primary key have unique values. At any time, no two rows in the table can neither have same values for the primary key nor can data value for such field be left blank. For example, in a student table, each student has a unique roll no., which forms the primary key. If, in a table we use more than one fields to identify a record, it is known as a Composite Key. For example, we may form a composite key consisting of fields roll no. and name. Relational Database – A relational database is a collection of related tables. Eg. On page no.150 Foreign Key – If a field or a combination of fields of one table can be used to uniquely identify records of another table, then that particular field is known as the foreign key. This foreign key helps to build a relation between two tables. Eg. on Page no. 151 In Student Registration Table, ‘Enrolment_Number’ is the primary key and in the Student Marks Table, ‘Roll_Number’ is the primary key, whereas ‘Enrollment_ Number’ is the foreign key. This foreign key can be used to set a relation between two tables. Candidate Key – All the field values that are eligible to be the primary key are the candidate keys for that table. Such fields can neither be left blank nor can have duplicate values. So in the table Student Marks, Enrollment Number and Roll Number both are candidate keys. Alternate Key – Out of the candidate keys, one or two are made as primary keys. The others are the alternate keys. Hence, if Roll Number is made as the primary key, Admission Number is the Alternate key. Objects of an RDBMS Forms – A form is a feature of a database using which we can enter data in a table in an easy and user friendly manner. A form consists of text boxes, labels, radio buttons, list boxes, check boxes etc. that give a user friendly interface for entering data. The data entered through the forms is stored in tables. Queries – A query is used to retrieve the desired information from the database. In simple terms, it is a question asked from the database. For example, if we want to view the names of only those students who have scored more than 50 marks, then we post a query. The data set matching the given criterion is retrieved from the table. Reports – The output of a query may be displayed in the form of reports. The usual result of the query is in the form of rows and columns. But if we want the report to be formal and in proper layout, then we can use the Reports feature of RDBMS. CHAPTER 9-- Starting with LibreOffice Base LibreOffice Base is a free and open source DBMS. It can be downloaded from www.libreoffice.org and is available for both Linux and Windows operating systems. Data Types Storage in Data Types Field Type in Base Range of values memory Tiny Integer TINYINT 2^8 = 256 | – 128 to + 127 1 Byte Small Integer SMALLINT 2^16 = 65536 | – 32768 to + 32767 2 Bytes 2^32 = 4294967296 | – 2147483648 to Integer INTEGER 4 Bytes + 2147483647 BigInt BIGINT 2^64 8 Bytes Unlimited, up to 50 places in the GUI, fixed Decimal DECIMAL variable decimal point, perfect accuracy Unlimited, up to 50 places in the GUI, fixed Number NUMERIC variable decimal point, perfect accuracy Float FLOAT Real REAL Adjustable, not exact, 15 decimal places Double DOUBLE 8 Bytes maximum Text VARCHAR Adjustable variable Adjustable, rest of actual text replaced with Text (fix) CHAR fixed spaces Memo LONGVARCHAR variable Stores the year, month and day as it is stored in Date DATE 4 Bytes the system. Stores the time of the day as hour, minute and Time TIME 4 Bytes second. Date/Time TIMESTAMP Stores date and time information at once. 8 Bytes This also can be given Yes/No BOOLEAN in multiple formats like Yes/No, True/False, On/Off. Binaryfield store BINARY fixed (fix) digitized images and sounds