database management system

 chapter :

databases management system class 12 notes

database management system

web frame work:-

web framework is a software tool that provides a way to build and run dynamic websites and web enabled application.

it provides four things-

–   URL mapping

–   database manipulation

–    template

–    security measures

some other web framework-  ZEND, Flask, ruty Perl etc.

Django

1.this is a high level python web frame work which speeds up development of a website.

2.this is a free and open source web application framework.

3.for web development,it provides exiting components.

it prevents repetition of work.

advantages of Django

1.support to various languages.

2.less coding.

3.don’t repeat yourself.

4. scalable

5.secured

how a website works

HTTP GET requested:-

an HTTP GET requested refers to a way of retrieving information from a web server using a given URL aver web.

HTTP POST requested:-

web client has to send some data. this data will be sent to the web server for storing in a database through a post requested.

working of Django

Django MVT

1.the MVT( mobile view template ) is a collection of three components model , view and template.

2.model help to handles database.

3.template handles user interface part completely.

4.view contracts with model and template,it renders a template.

 Revision Notes (Database Concepts and SQL)

Relations:-

In relational data model the data is organised into tables(in the  rows and columns format ) is called relations.

Domain:-

A domain is the sets of values from which the actual values are appearing in a given column are drawn.

Tuple:-

A horizontal row in a relation.

Attribute:-

A vertical column in a relation.

degree:-

No. of column in a table is called degree.

cardinality :-

No. of records in a table is called cardinality.

Primary Key:-

A primary key is a set of one or more attribute that can uniquely identified is called primary key.

databases management

Candidate Key:-

these are set of fields (columns with unique values) in the relation that are eligible to act as a primary key.

Alternate Key:-

A candidate key that is not the primary key is called alternate key.

DDL :-

Data Definition Language (DDL) OR Data Description Language (DDL).

DML:-

Data Manipulation Language (DML).

String datatypes:-

CHAR, VARCHAR, VARCHAR2

Numeric datatype:-

NUMBER, NUMERIC, INT, FLOAT, DECIMAL

Date:-

DATE

Selection:-

Selection in relational algebra returns those tuples (records) in a relation that fulfill a condition (Produce table containing subset of rows).

Projection:-

Projection in relational algebra returns those columns in a relation that given in the attribute list (Produce table containing subset of columns).

Union:-

The union operator is used to combine two or more tables. In the union operation, duplicate records will be automatically removed from the resultant table.

Cartesian product:-

SQL joins are used to relate information in different tables. Cartesian product returns a number of rows equal to number of rows in the first table multiply by number of rows in the second table. At the same time, number of columns equal to number of columns in the first table added by number of columns in the second table.

database management system

SQL (Structured Query Language)

CREATE TABLE:-

Used to create the structure of a table.

CREATE TABLE table_name (column1 datatype, column2 datatype, column3  datatype,….);

ALTER TABLE:-

Used to implement structure modification.

To add a new column after creating table:-

ALTER TABLE table_name ADD column_name datatype;

To modify an existing column.

ALTER TABLE table_name MODIFY COLUMN column_name datatype;

DROP TABLE:

To remove a table  and remove all of its data

DROP TABLE table_name ;

INSERT INTO:-

is used to insert new records in a table.

INSERT INTO table_name (column1,column2,column3, ..) VALUES(value1, value2, value3, ..);

SELECT:-

The SELECT statement is used to select and display data from a database.

SELECT column1, column2, … FROM table_name;

SELECT * FROM table_name;

SELECT column1, column2, … FROM table_name WHERE condition;

DISTINCT:-

Distinct keyword eliminates duplicate rows from the result of a select statement.

SELECT DISTINCT column1, column2, … FROM table_name;

ORDER BY :-

Used to sort the result-set in ascending or descending order.

SELECT column1, column2, … FROM table_name ORDER BY  column1 … ASC|DESC;

GROUP BY :-

Used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns

SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s)

HAVING :-

Places condition on groups.

SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition

MAX ():-

To select the maximum value of a particular column.

SELECT MAX(column_name) FROM table_name WHERE condition;

MIN ():-

To select the minimum value of a particular column.

SELECT MIN(column_name) FROM table_name WHERE condition;

SUM ():-

To find the total value of a particular column.

SELECT SUM(column_name) FROM table_name WHERE condition

AVG ():-

To find the average value of a particular column.

SELECT AVG(column_name) FROM table_name WHERE condition;

COUNT ():-

Returns the number of records in the table.

SELECT COUNT(column_name) FROM table_name WHERE condition;

UPDATE :-

Used to modify the existing records in a table.

UPDATE table_name SET column1 = value1, column2 = value2, …WHERE condition;

DELETE :-

Used to delete existing records in a table.

DELETE FROM table_name WHERE condition

Important questions  (database management system)

Q 1. Write two examples of DML commands to SQL.

Ans. SELECT, INSERT

Q 2. When using the LIKE clause, which wildcard symbol represents any sequence of none, one or more characters.

Ans. The % wildcard symbol is used in LIKE clause to represent any sequence of none, one or more characters.

Q 3. Write the UPDATE statement in MySQL to increase commission by 100.00 in the “Commission” column in the ‘EMP’ table.

Ans. UPDATE Emp

SET Commission = Commission +100

database management system