databases management system class 12 notes
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
– security measures
some other web framework- ZEND, Flask, ruty Perl etc.
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.
3.don’t repeat yourself.
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
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)
In relational data model the data is organised into tables(in the rows and columns format ) is called relations.
A domain is the sets of values from which the actual values are appearing in a given column are drawn.
A horizontal row in a relation.
A vertical column in a relation.
No. of column in a table is called degree.
No. of records in a table is called cardinality.
A primary key is a set of one or more attribute that can uniquely identified is called primary key.
these are set of fields (columns with unique values) in the relation that are eligible to act as a primary key.
A candidate key that is not the primary key is called alternate key.
Data Definition Language (DDL) OR Data Description Language (DDL).
Data Manipulation Language (DML).
CHAR, VARCHAR, VARCHAR2
NUMBER, NUMERIC, INT, FLOAT, DECIMAL
Selection in relational algebra returns those tuples (records) in a relation that fulfill a condition (Produce table containing subset of rows).
Projection in relational algebra returns those columns in a relation that given in the attribute list (Produce table containing subset of columns).
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.
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)
Used to create the structure of a table.
CREATE TABLE table_name (column1 datatype, column2 datatype, column3 datatype,….);
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;
To remove a table and remove all of its data
DROP TABLE table_name ;
is used to insert new records in a table.
INSERT INTO table_name (column1,column2,column3, ..) VALUES(value1, value2, value3, ..);
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 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)
Places condition on groups.
SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition
To select the maximum value of a particular column.
SELECT MAX(column_name) FROM table_name WHERE condition;
To select the minimum value of a particular column.
SELECT MIN(column_name) FROM table_name WHERE condition;
To find the total value of a particular column.
SELECT SUM(column_name) FROM table_name WHERE condition
To find the average value of a particular column.
SELECT AVG(column_name) FROM table_name WHERE condition;
Returns the number of records in the table.
SELECT COUNT(column_name) FROM table_name WHERE condition;
Used to modify the existing records in a table.
UPDATE table_name SET column1 = value1, column2 = value2, …WHERE condition;
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