Database Concepts Class 12 CBSE

1. What is database?

Database is a collection of related information.

2. What is Database Management Systems (DBMS)?

DBMS is a software to store and maintain data in the form of tables. We can easily create, modify, delete and view data from database.

Examples: Ms-Access, MySQL, SQLite, Microsoft SQL Server, Oracle etc.

3. What is relational data model?

Relational data model is a data model in which information is represented as collection of related tables. Each table is called a relation. Each relation has a unique name



4. Define a relation.

Relation is also called table. Relation is defined as a collection of data in the form of rows and columns.

Example:

Relation: Student
RegNo Name Class PhoneNo
1 Ayush 12 A 9898989898
2 Sumit 12 B 8000988880
3 Rohini 12 A 9988776655

5. What is domain?

Domain is set of values that can be put into a particular field of a table.
Example:
i. The domain of gender column has a set of two possible values Male or Female.
ii) The domain of RegNo is set of integer values.

6. What is attribute?

Attribute is also called field or column of a table. It is the smallest piece of information.

Example: In above table, RegNo, Name and Class are attributes.

7. What is tuple?

Tuple is also known as record or row. It is defined as collection of attributes. It is used to store information about a single entity.

Example:

In above table, one row gives information about one student only. 1, Ayush, 12 A specifies one row.

8. Define a Key?

Key is a field of table. which helps to enforce integrity and identify the relationship between tables.

9. Define Primary Key?

It is set of one or more columns that can uniquely identify records within a table

Example: In above table student, RegNo can be Primary key as registration number of students is always unique.

10. Define Candidate Key?

Fields of a table that can serve as primary key are called Candidate keys i.e. these fields should contain unique values only.

Example: In above table student, RegNo and PhoneNo can be Candidate key as both these field contain unique values.

11. Define Alternate Key?

Out of the candidate keys, one can can as primary key, the remaining keys are called alternate key.

Example: In above table student, RegNo is primary key and PhoneNo is alternate key

12. Define Foreign Key?

It is a field whose values are derived from primary key of another table. Foreign key can be used to
establish a link between two tables.

13. Define Degree?

Number of attributes (columns) in a table is known as degree of that table.

Example: Degree of table student is 4 as it contains 4 fields.

14. Define Cardinality?

Number of tuples (rows) in a table is known as cardinality of that table.

Example: Cardinality of table student is 3 as it contains 3 records.



15. What is SQL?

SQL stands for Structured Query Language. It is a standard language used for accessing databases. It can be used to create a table, manage manipulate data in it.

SQL can be used to perform following tasks:

  1. Create, modify and drop tables.
  2. Inserting, updating, and deleting records in a table
  3. Display records from a table.
  4. Controlling access to the database and tables.
  5. Applying constraints to tables.

16. What are advantages of SQL?

  1. SQL is portable i.e it can run on different hardware as well as software platforms..
  2. SQL queries can be used to retrieve large amounts of records from a database quickly and
    efficiently.
  3. It is easy to learn and understand.
  4. SQL can be  used with any DBMS system .
  5. It is also used to manage security of a database.
  6. SQL acts as both programming language and interactive language.
  7. SQL can be used for linking front end (software interface) and back end (database).
  8. SQL supports the latest object oriented programming  languages.

17. Explain types of SQL Statements.

The SQL statements are categorized into following  categories

i. Data Definition Language (DDL) statement
ii. Data Manipulation Language (DML) statement
iii. Transaction Control Statement
iv. Session Control Statement
v. System Control Statement

18. Explain DDL and DML statements of SQL.

a. DDL stands for  Data Definition Language. It is a set for commands used to create, modify and delete structures of database and its objects. There are three DDL statements

  1. CREATE  TABLE
  2. ALTER TABLE
  3. DROP TABLE.

b. DML stands for Data Manipulation Language (DML). It is a set of commands to insert, delete, modify and retrieve data from database tables. There are four DML statements:

  1. SELECT
  2. UPDATE
  3. DELETE
  4. INSERT

19. Explain different data types of SQL

Data type is the way to define the range and type of values that can be stored in a field. Different data types of SQL are:

1. NUMBER /DECIMAL

This data type is used to store the numeric data . It may or may not include decimal point.

The field of number data type can store a maximum value of 9.99´10124.  This data type can be used in three forms.

a. NUMBER/DECIMAL

In this form we don’t need to specify the number of digits to be stored in a particular field.

Example:        

create table student(fees number);

OR

create table student(fees decimal);

b. NUMBER(P)/DECIMAL(P)

In this form we can specify the maximum number of digits which can be stored in a field of NUMBER type. Here P is called precision.

Example:   

create table student (fees number (5));

OR

create table student (fees decimal (5));

In above examples, the field fees can contain a numeric value of maximum five digits i.e. 99999.

c. NUMBER(P,S)/ DECIMAL (P,S)

In this form we can specify the maximum number of digits as well as the number of digits after decimal point which can be stored in a field .

Here P is called precision and S is known as scale.

Example:

create table student (fees number (7,2));

OR

create table student (fees decimal (7,2));

In above example, the field  fees can contain a numeric value of maximum seven digits and which can contain two digits after decimal point i.e. 99999.99 is the maximum value which can be stored in field named fees.

2. CHAR

This data type is used to store alphabets, digits, special characters as well as spaces. This data type is used for fixed length string data . The field of this data type can store maximum of 255 characters.

We need to specify the size when we declare a field of this data type which is used to specify the maximum number of characters which can be stored in that field.

If the value stored in this type of field has lesser number of characters than the maximum size then blank spaces will be filled in rest of the size.

Example:

create table student( name char(20));

In this example name field can contain maximum of 20 characters.

3. VARCHAR

This data type is also used to store alphabets, digits, special characters as well as spaces.

This data type is used for variable length string data . The field of this data type can store maximum of 2000 characters.

We need to specify the size when we declare a field of this data type which is used to specify the maximum number of characters which can be stored in the field.

If the value stored in this type of field has lesser number of characters than the maximum size then empty space will not be wasted but used in next field.

Example

create table student(name varchar(20));

In this example name field can contain maximum of 20 characters.

4. VARCHAR2

This data type is also used to store alphabets, digits, special characters as well as spaces. This data type is used for variable length string data . The field of this data type can store maximum of 4000 characters.

We need to specify the size when we declare a field of this data type which is used to specify the maximum number of characters which can be stored in the field.

If the value stored in this type of field has lesser number of characters than the maximum size then empty space will not be wasted but used in next field.

Example

create table student(name varchar2(30));

In this example name field can contain maximum of 30 characters.

5. DATE

This data type is also used to store date type data. Which can contain date as well as time.

The dates are from January 1, 4712 BC to December 31, 9999 AD.  The most common date format is YYYY-MM-DD

Hhere DD specifies the day which can have values from 1 to 31. MM specifies the month which can take values from 01 to 12 and YYYY specifies the Year of our digits.

Example

create table student(dateofbirth date);



Spread the love
Lesson tags: Advantages of using SQL, alternate key and foreign key, attribute, candidate key, cardinality, Concept of domain, Data Definition Language and Data Manipulation Language, degree, Introduction to database concepts and its need., key, primary key, relation, sql data types, Structured Query Language, tuple
Back to: CBSE class 12 Computer Science notes
Spread the love