6 SQL Bangla Tutorials
6 SQL Bangla Tutorials
o
o
o
o
o
o
o
o
o
o
o
o
o
o
# , 1
)
)
Query )
- )
J )
+ )
) #(
1 # 5 + 67 &
:
) ? ( - # + 8 ।
# 8 + 9 SQL ? , ।
= * O ) $) 0 ( friends
P, ।
SELECT*FROM friends
Q case sensitive "- : ‘select*from friends’ 6 SELECT*FROM friends (
+ , ।
SQL DML DDM
# ;< = 1
DDL-Data Defination Language: ( , #( , $index(keys) G , ,(0
'# 6 ) * , , '# constraints R ( , # ($* S+! DDL statement * ,
CREATE DATABASE- ,
ALTER DATABASE- T( ,
CREATE TABLE- ,
ALTER TABLE- T( ,
CREATE INDEX- INDEX ,
DROP INDEX- INDEX 3 )
DML-Data Manipulation Language
Query (" E ) 6 update SQL DML "6= ( , ।
SELECT- -
UPDATE- + (, * ()
DELETE- - -# 3 (
INSERT INTO- -# J
( ( designer 3।
A
' - + - 0 P # , 0 # ,
USE database_name( ) 0 # , database_name * 0 ( ( $)
B
" 3
DROP DATABASE database_name( ) 0 3 database_name * 0 ( ( $)
3 , ) 2 (undo) U , - 0 ,
) 0 3 ( ।
0 V +
CREATE TABLE table_name( ) table_name * 0 ( ( $) ( , :
designer ) 0 3 8 ( ( ( ) 6 SQL # 8 ?0
1.CREATE TABLE `designer`.`test` (
2.`id` INT( 10 )NOT NULL AUTO_INCREMENT PRIMARYKEY ,
3.`first name` VARCHAR( 15 ) NOT NULL ,
4.`last name` VARCHAR( 15 ) NOT NULL ,
5.`email` VARCHAR( 20 ) NOT NULL,
6.`course name` VARCHAR( 20 ) NOT NULL DEFAULT'WDAD',
7.`mobile` INT( 12 ) NOT NULL
8.)
= +/ 3 J ) ( + ) 0 2[ # # - $( id, first
name, last name * , 0 2[)
2[
)( 0 2[ # - , J ,
INSERT INTO test VALUES (8, 'Rahman', 'Abidur', ' [email protected]',
‘WDAD’, ‘01195229300’)
+ =' (\ J + $)
1.INSERT INTO test(firstname, lastname) VALUES (‘Harun', ‘Rashid')
+/ 3 (\ J + ।
1.INSERT INTO test SET id = 9
" # # 2[* 2 2] # - ।
@. + ' , ( + $) + 0
(row) " #/ ( (uniquely) ^ ।
X.) ( ' , , * .
- ।
B. 2 - ।
B. * 0 ) 0 )(
first name )(
, - , - - - ) U 3 ,
+ first name last name W_ +)` PRIMARY
KEY ) ) " # (unique) , $ # ) id number PRIMARY
KEY , , ( id , $ a + ) (first name,last name
= = ,email = = L # (- ) J ।
SHOW TABLE 0 ( ( ) ।
DESCRIBE TABLE ( Z +1 ( ) $ ) DESCRIBE test 0 0
(
TABLE ALTERATI ON
+ = + = MYSQL + 2 " "+= + )
1.alter table table_name add PRIMARY KEY (col_name,...)
2.alter table table_name ADD UNIQUE (col_name,...)
3.alter table table_name DROP PRIMARY KEY
4.alter table table_name ALTER [COLUMN] col_name {SET DEFAULT literal
|DROP DEFAULT}
O + )* , ,PRIMARY KEY - #( + ।
1.alter table table_name drop column column_name
table_name * column_name * ( - 0 3
( + ।
1.alter table table_name add column column_name data_type [NULL/not NULL]
( )* + $ * ।
- ( SELECT 0 # , , $)
select * from test
+ test 0 + , 2 ।
* * )( ( , =' * ( $)
SELECT firstname,lastname FROM test
SELECT ( (\ "6= ( + "-# : R ( + D + (
$)
select JOB, SAL from EMPLOYEES Limit 10
' + employees 3 , - + 71 + ?0 WA
0 ( ।
# WHERE Clause ,
:
( 5 ) $)
1.select JOB, SAL from EMPLOYEES where SAL > 1500
6 # (Numeric) = ) ।
R
SELECT * FROM Persons WHERE FirstName='Tove
AND (, :
1.SELECT * FROM Persons
2.WHERE FirstName='Tove'
3.AND LastName='Svendson'
OR (, :
1.SELECT * FROM Persons
2.WHERE FirstName='Tove'
3.OR FirstName='Ola'
AND,OR Operator - # , condition ) + $)
(, :
1.SELECT * FROM Persons WHERE
2.LastName='Svendson'
3.AND (FirstName='Tove' OR FirstName='Ola')
QUERY ORDERBY
1.select ENAME, DEPTNO, HIREDATE from EMPLOYEE
2.order by DEPTNO [asc], HIREDATE desc
) * ( * 3 - Y(ascending) 6 Y - 3 (descending) ( + ।
QUERY BETWEEN
1.select EMPNO, ENAME, SAL from EMP where SAL between 1500 and 2500
2.select ENAME from EMP where HIREDATE between ’02-APR-81’ and ’08-SEP-81
( (\ + '# "6= ( + ।
1.SELECT productCode, FROM products
2.WHERE buyPrice NOT BETWEEN 20 AND 100
AND #( # , QUERY (7 + ।
( + ( )( + c @A XA।
1.SELECT officeCode, city FROM offices
2.WHERE country IN ('USA','France')
3.
4.
5.SELECT officeCode, city FROM offices
6.WHERE country NOT IN ('USA','France')
* = Z , statement * ( a ) ।
:
/0 S QUERY U+
7 = ) SELECT statement ( - ( ) $ Q Z
H 6 71 =' - ( " * 3 3
F- $ + SELECT statement - SQL JOIN T! ( + ।
*d 0 V +
1.SELECT column_list
2.FROM table_1
5.…
6.WHERE conditions
2.FROM table_name1
4.ON table_name1.column_name=table_name2.column_name
(, :
Persons table
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
Orders table
O_Id OrderNo P_Id
1 77895 3
2 44678 3
3 22456 1
4 24562 1
5 34764 15
2.From Persons
3.INNER JOIN Orders
4.ON Persons.P_Id=Orders.P_Id
5.Order BY Persons.LastName
Result ,
LastName FirstName OrderNo
Hansen Ola 22456
Hansen Ola 24562
Pettersen Kari 77896
Pettersen Kari 44678
0" # # (table_2,table_3) - )( - - $)
1.SELECT Persons.Lastname,FirstName,Orders.OrderNo
2.FROM Persons
3.RIGHT JOIN Orders
4.ON Persons.P_Id=Orders.P_Id
5.ORDER BY Persons.LastName
6 2 2 ( ।