mysql
function f3(){
window.open("A.html","","height=500px,left=200px,top=50px,width=500px");
}
mysql:----
sql:---structured query language
it allows to access and manipulate data.
RDBMS:--
Relational database management system(2 table)
architure:--
enrollment table:--
student_enrollno(pk) student_name student_course student_address
student table:--
student_enrollno(fk) student_name student_course student_atendance
library table:--
student_enrollno(fk) student_name book_name book_isue_date
join table.....
select* from tables...
the data in Rdbms is stored in objects called table.
Table:-
A table is a collection of related data entries and it consists
of columns and rows.
sqlqueries:---
DDL:---
data defination language...
create,alter,drop
DML:--
data manipulation language...
insert,update,delete
Dcl:--
data control language
grant,revoke
Tcl:---
transaction control language
commit,rollaback,savepoint
//.........
create database datbasename
use databasename
create table employee_records(employee_id int(10),employee_name
varchar(32)............);
///insert into employee_records(employee_id,employee_name,...)
values(1,'abc'........);
count how many manger in your table:--
select count(employee_id) from employee_record
where employee_designation="manager"
find min salary person name with all records
find max salry person name with all records
find sum of the salary
find avg of the salary
find no of records in the table:--
select count(employee_id) from employee_record;
find no of manager in the table:-
select count(employee_id) from employee_record WHERE
employee_designation="manager"
find min salary:
select min(employee_salary) from employee_record;
find max salary:-
select max(employee_salary) from employee_record
find avg salary:--
select avg(employee_salary) from employee_record
find sum salary:--
select sum(employee_salary) from employee_record
Group by:--
......................
select count(employee_id),employee_designation from employee_record GROUP BY employee_designation;
....................
select count(employee_id),employee_designation,employee_name from
employee_record GROUP BY employee_designation DESC;
....................
Group by and having clause:.
....................
list the number of employee_desiganation in each employee
dessignation .only include designation with more
than 1 designation.
select count(employee_id),employee_designation
from employee_record GROUP BY employee_designation having count(employee_id)>1;
.........................
select count(employee_id),employee_designation
from employee_record GROUP BY employee_designation having
count(employee_id)>2;
..............................
Like operator:---
it is used in a where clause to serach for a specific pattern
there are two wildcards used in conjuction
with the like operator
1 % represent zero ,one or multiple char
2_ represent one single character
find all data from the table which has employee_designation
started with character m...
select * from employee_record
where employee_designation like 'm%'
1...search box:--text box button.....table all data of a name
search box key press a all data show(a)
find the data which has min salary in the table..
full join:--
/*directly not supported by mysql*/
SELECT id,name
FROM student_record
FULL OUTER JOIN teacher_records ON
teacher_records.id= student_record.id;
/*we have to use union operator*/
Left join
SELECT *
FROM student_record
LEFT JOIN teacher_records ON
teacher_records.id= student_record.id;
Right:
SELECT *
FROM student_record
RIGHT JOIN teacher_records ON
teacher_records.id= student_record.id;
/*full*/
SELECT *
FROM student_record
LEFT OUTER JOIN teacher_records ON
teacher_records.id= student_record.id
UNION
SELECT *
FROM student_record
RIGHT OUTER JOIN teacher_records ON
teacher_records.id= student_record.id;
*///////.......*/
cross join:-
SELECT *
FROM student_record CROSS JOIN
teacher_records
self join:-
SELECT a.id, b.name
FROM student_record a, student_record b
WHERE a.id = b.id;
Comments
Post a Comment