Friday, October 6, 2023

DBMS WITH MS ACCESS & RDBMS WITH SQL

 

DBMS WITH MS Access

MS Access - माइक्रोसॉफ़्ट ऐक्सेस (Microsoft Acess) एक डेटाबेस प्रबन्धन प्रणाली है, जिसकी रचना और वितरण माईक्रोसॉफ्ट ने अपनी माइक्रोसॉफ्ट विन्डोज़ और मैक ओएस एक्स के लिए किया है। यह अनुप्रयोग माईक्रोसॉफ्ट ऑफिस का एक भाग है। इसका उपयोग डेटाबेस बनाने, डेटाबेस को मैनेज करने, विश्लेषण करने एवं रिपोर्ट बनाने में किया जाता है।

Home>Views>Design view

Create a field:- Employee - Data Field निम्नानुसार  बनाए

Field name                  Data type                    Description

ID                                Auto number

NAME                                    TEXT                         

AGE                            Number

POST                          TEXT

SALARY                    CURRENCY

DOJ                             DATE

ENDER                      LOOKUP WIZARD

Then SELECT datasheet view from View enter Enter 10 records on it like this

EMPLOYEE

ID

NAME

AGE

POST

SALARY

DOJ

GENDER

MOBILE

DOCUMENTS

1

RAVIKANT SAHU

35

PEON

$15,000.00

01-MAY-00

MALE

87985758444

SELECT photo for everyone.

2

SEEMA SINGH

30

GARD

$16,000.00

01-JUN-05

FEMALE

65435453544

3

SURESH

25

MANAGER

$25,000.00

01-JUN-15

MALE

65465454444

4

DURYODHAN

26

AG3

$25,500.00

01-MAY-05

MALE

35564545444

5

SURESH

27

FIELD ASS

$19,900.00

01-SEP-09

MALE

64654654544

 

Form - MS Access में फार्म का प्रयोग किसी डेटाबेस टेबल में डाटा को सरलता पूर्वक प्रविष्ट(Enter) करने के लिए किया जाता है. दूसरे शब्दों में जो आपके डाटाबेस फाइल में आपने tables बनाए हैं उन tables में बहुत आसानी से डाटा को अर्थात रिकार्ड को फार्म के द्वारा रख सकते हैं|

Report - MS Access में रिपोर्ट का प्रयोग हम Database File में उपलब्ध रिकॉर्ड अर्थात डाटा को प्रिंटेड अर्थात प्रिंटर द्वारा छापी गई पेज पर सूचनाएं जिन्हें हार्ड कॉपी कहा जाता है, को प्रस्तुत करने का प्रभावशाली तरीका है.

Relationship - माइक्रोसॉफ्ट एक्सेस में दो अलग-अलग टेबल के डाटा को कम्बाईन करने के लिए रिलेशनशिप का प्रयोग किया जाता है। रिलेशनल डेटाबेस में दो टेबल के डाटा आपस में जुड़े होते हैं यानि उनमे कोई न कोई सम्बन्ध होता है। एमएस एक्सेस के डेस्कटॉप एप्प में रिलेशनशिप कमांड में जाकर रिलेशनशिप क्रिएट किया जा सकता है।

Types Of Relationship :

One To One - इस में एक टेबल की एक Row दूसरी टेबल की भी केवल एक Row से संपर्क बनाएगी|

One To Many - इस में एक टेबल की एक Row दूसरी टेबल की एक से अधिक Row के साथ संपर्क बना सकती है।

Many To Many- इस में एक टेबल की एक या एक से अधिक Row दूसरी टेबल की केवल एक Row के साथ ही संपर्क बना सकती है।

 

Join - जॉइन ऑपरेशन का उपयोग जॉइन टू ऑपरेशन के लिए किया जाता है यह जॉइन ऑपरेशन कार्तीय गुणन और चयन प्रक्रिया का एक संयोजन है join operation  में हम cartesian operation perform करते हैं और उसके ऊपर selection process apply करते हैं।

Join Operation दो प्रकार के होते हैं:-

1.    Inner Join  - inner join में Normal, Theta, और Equi join होता हैं. Resulting Relation में Inner join में सिर्फ वही tuples आते हैं जो match होते हियँ बाकि सब discard कर दिए जाते हैं।

2.    Outer Join –  दो टेबल्स को join करते समय यह आवश्यक नहीं हैं की एक table के row या डाटा दूसरे table के row या data से मैच हो, इसमें जो डाटा मैच नहीं होता हैं वो भी include किया जाता हैं। Outer Join 3 प्रकार का होता हैं:-

§  Left Outer Join- left outer join में join condition की बायीं ओर के tables के सारे रिकॉर्ड प्रदर्शित किये जाता हैं, इस प्रकार की condition के दायीं ओर matching record को प्रदर्शित किया जाता हैं।

 

§  Right Outer Join   right outer join में join condition की दायीं ओर के tables के सारे रिकॉर्ड प्रदर्शित किये जाता हैं, इस प्रकार की condition के बायीं ओर matching record को प्रदर्शित किया जाता हैं।

 

§  Full Outer Join Full Outer Join में LEFT table और RIGHT table में matches हो या ना हो ये दोनों table के सभी records को return करता है अगर match नहीं होता है तो ‘NULL'(no value) return होती है |

 

Primary Key - डेटाबेस की तालिका (Table) में column या कॉलम का समूह जो हमें विशिष्ट रूप से पहचानने में मदद करता है उस तालिका की प्रत्येक पंक्ति(row) को प्राथमिक कुंजी कहा जाता है

Unique Key -  एक तालिका में, Unique keys प्रतिबंध होती हैं जिनका उपयोग विशिष्ट रूप से टुपल्स (rows) की पहचान करने के लिए किया जाता है। तालिका में कई अद्वितीय कुंजियाँ (unique keys) हो सकती हैं। यदि एक अद्वितीय कुंजी का उपयोग किया जाता है, तो कुंजी का मान NULL पर सेट किया जा सकता है।

Foreign Key : एक संबंध (relation) के ऐसे एटरब्यूटस, जो किसी अन्य संबंध (relation) की एक उम्पमीदिार कुंजी (Candidate Key) से मेल खाते है, फॉरेन की कहलाते हैं । एक संबंध (relation) में कई विदेशी कुंजि (फॉरेन की / Foreign Key) हो सकती हैं, ये कुंजीयाँ विशभन्न संबंधों (relations) से जुड़ी हो सकती हैं।

 

Query - एम. एस. एक्सेस में यूजर कई प्रकार से अपने डेटा को ढूँढ सकते हैं, उसे छाँट सकते हैं और प्रदर्शित कर सकते हैं। अनावश्यक दोहराव से बचने के लिए यूजर ढूँढने की शर्तों को आगे के प्रयोग के लिए बचाकर भी रख सकते हैं। इस प्रकार वांछित अनुसार कोई डेटा ढूँढना क्वैरी कहलाता है।

 

 

 

 

 

Ø  Query with design view-  क्वेरी डिज़ाइन बनाने के लिए  निम्न चरण अपनाये 

Create Query wizard from Create>other>Query Wizard> SELECT Simple Query Wizard>SELECT all field >Next> Detail>Next>SELECT Modify the query>Finish

(आप सभी तालिकाओं पर कर्मचारी क्वेरी देख सकते हैं और फिर पैनल पर क्लिक कर सकते हैं)

Home>View>SELECT Design View> and Do your Query & Run it in many ways like this :-

 

Show    :-   तालिका पर चयनित फ़ील्ड दिखाने के लिए चिह्नित करें

Sort      :-   आरोही और अवरोही क्रम में सभी रिकॉर्ड देखने के लिए

Criteria :-   तालिका का चयनित श्रेणी विवरण देखने के लिए

a* in name field, - for see all employee name started wit 'a'

       or  :- एक से अधिक चयनित श्रेणी विवरण देखने के लिए  उद्दाहरण age>33,salary<25000

डेटाबेस  के आधार पर निम्नप्रश्नो के क्वेरी बनाये :-

Que.1        Write a query to display all Age greater then 33 ?

Query -      Age , criteria >33

Que -         Write a query to display all Male record?

Design View – Gender Field , criteria =’male’

Que -         Write a query to display all Manager?

Que           Write a query to display record of junaid?

Que           Write a query to display all Age greater then 33 and salary<25000

Que           Write a query to display all peon list?

Que           Write a query to display male list where salary is >40000

Que           Write a query to display male & female ascending order?

Que           Write a query to display descending order of age, salary, gender male fist?

               

                                             RDBMS WITH SQL

Relational Data Base Management System with Structured Query Language

SQL (स्ट्रक्चर्ड क्वेरी लैंग्वेज) एक कंप्यूटर भाषा है जो डेटाबेस प्रोग्राम द्वारा समझी जाने वाली अंग्रेजी से काफी मिलती-जुलती है। SQL को जानना महत्वपूर्ण है क्योंकि Microsoft Access में प्रत्येक क्वेरी SQL का उपयोग करती है। यह समझना कि SQL कैसे काम करता है, बेहतर क्वेरी बनाने में मदद कर सकता है, और आपके लिए किसी क्वेरी को ठीक करना आसान बना सकता है जब वह आपके इच्छित परिणाम नहीं लौटा रहा हो।

Ø  SQL clause Work :-


Types of SQL :- Here are five types of widely used SQL queries.

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • Data Control Language(DCL)
  • Transaction Control Language(TCL)
  • Data Query Language (DQL)

SQL Commands with Query Report

Make table using SQL commands


Student

ROLLNO

SNAME

FNAME

GENDER

CLASS

SEC

PERCENT

RESULT

101

RAGINI

VISHAL

FEMALE

11

B

78

PASS

102

SOHAN

SOKESH

MALE

11

B

72

PASS

103

ROHAN

ROKESH

MALE

12

A

76

PASS

104

JOHAN

JOKESH

MALE

10

A

55

PASS

105

MOHAN

MOKESH

MALE

10

B

34

FAIL

106

TOHAN

TOKESH

MALE

10

B

36

FAIL

107

VOHAN

VOKESH

MALE

11

A

75

PASS

108

SIMA

SOKESH

FEMALE

12

A

68

PASS

109

RIMA

TOKESH

FEMALE

12

B

64

PASS

110

TINA

JOKESH

FEMALE

12

B

58

FAIL

111

RINA

ROKESH

FEMALE

11

A

45

FAIL

 

 

Ø  To Create a table

1.      Student Mark data

Create table student

(

rollno int not null primary key,

sname varchar(20),

fname varchar(20),

gender varchar(10),

class int,

sec varchar(1),

Percent int,

result varchar(10)

)

2.      Student Fee Detail

Create table studentfee

(

rollno int not null primary key,

sname varchar(20),

RegFee int,

Installment1 int,

Installment2 int,

Installment3 int,

Installment4 int,

ExamFee int

)

3.      Student Fee Detail

Create table studentlib

(

rollno int not null primary key,

sname varchar(20),

Ba1 varchar(20),

Badate1 varchar(20),

Submisiondate

Ba2 varchar(20),

Badate2  varchar(20),

Submisiondate

)

 

Ø  To Add Record on Table :-

INSERT INTO student VALUES (ROLLNO,'sname','fname', 'gender', class,'sec',persent,'result');

INSERT INTO student VALUES (101, 'RAGINI','VISHAL', 'Female', 11,'B',78, 'PASS');

Same as Add 20 Record in student table

Query 01- Write a query to Add 20 new Student record

Ø  To Display a record

Que.1 -      Write a query to display all female record?

Query        SELECT * from student where gender='female'

Que.2        Write a query to display all Pass student?

Query        SELECT * from student where result='pass'

Que.3        Write a query to display all 10th student list?

Query        SELECT * from student where class=10      

Que.4        Write a query to display all Student name, Father's name & Result?

Query        SELECT sname, fname, result from student

Que.5        - Write a query to display record between rollno 104 and 110

Query        SELECT * FROM student WHERE rollno between 104 and 110

      Que.6 Write a query to display record name started with 'm' character.

Query        SELECT * from student where sname like 'm*'; ‘R%’          WILD CARD

Que.7        Write a query to display all Male record?

Query

Que.8        Write a query to display all Fail student?

Query

Que.9        Write a query to display all 12th student list?

Query

Que.10      Write a query to display all A sec Student detail?

Query

Que.11      Write a query to display of Student name is Rohan detail?

Query

Que.12      Write a query to display of Student which father's name is Tokesh?

Query

Que.13      Write a query to display all Rollno, Student name, class?

 

Ø  Use it also with Relation operators

Equal to                 =                      , Does not Equal                      <>

Greater then          >                      , Greater then & Equal to        >=

Less then               <                      , Less then & Equal to            <=

Note :-       (Use 'B' for character data its not use in numeric data)

 

SELECT * from student where percent>50 (Display all record There Percent Greater then 50)

SELECT * from student where percent<50 (Display all record There Percent Less then 50)

SELECT * from student where percent=50 (Display all record There Percent Equal to 50)

SELECT * from student where percent<=50 (Display all record There Percent Less then & Equal to 50)

SELECT * from student where percent>=50 (Display all record There Percent Greater then & Equal to 50)

SELECT * from student where percent<>50 (Display all record There Percent Doesn’t 50)

 

Que.1        Write a query to display all 10th student list?

Query

Que.2        Write a query to display all 11th student list?

Query

Que.3        Write a query to display all 12th student list?

Query

Que.4        Write a query to display all list after roll no. 105?

Query

Que.5        Write a query to display all list Before roll no. 105?

Query

Que.6        Write a query to display of roll no. 105?

 

 

Ø  To Display a record with Join Operator

AND               When Enter All value is true

OR                  When Entered value may be some has true some has false both conditions

NOT                When Enter All value are false

 

Query -      Write a query to display all pass female student which has pass

SELECT *FROM student where gender='female' and result='pass'

 

Query -      Write a query to display all Male student of class 11th

SELECT *FROM student where gender='male' and class=11

 

Query -      Write a query to display all 12th student there Percentage is Greater then 70

SELECT *FROM student where class=12 and percent>70

 

Query -      Write a query to display all pass Male student which has pass?

Query -      Write a query to display all Male students in class 12th?

Query -      Write a query to display all Student of class 11th Sec A?

Query -      Write a query to display all class 11th & 12th?

Query -      Write a query to display all Pass Student in 11th?

Query -      Write a query to display all record of second division student?

Query -      Write a query to display all Third Division Student list of 12th class?

Query -      Write a query to display all fail students Only Roll no & name of 12th class?

 

 

Ø  Sorting with Records

For Ascending – asc;        , For descending – desc;

Que.1        Write a query to display name is ascending order.

Query SELECT * FROM Student ORDER BY Student.SNAME asc;

Que.2        Write a query to display name is descending order.

Query        SELECT * FROM Student ORDER BY Student.SNAME DESC;

Que.3-       Write a query to display Class wise is ascending order?

Query

Que.4 -      Write a query to display gender wise is ascending order?

Query

 

Que.5-       Write a query to display result wise is descending order. ?

Que.6 -      Write a query to display Class & sec wise is ascending order. ?

Que.7 -      Write a query to display name is descending order. ?

 

Ø  Use Count Function

Query - Write a query to display total number of male & female.

SELECT gender, count(*) from student GROUP BY gender;

Same do for male, class, Percentage, etc,

SELECT Max(percent) from student ;

 

Aggregate function – count, sum, max, min, avr ,

Query - Write a query to display total number of Pass & Fail?

uery - Write a query to display total number of 10th, 11th & 12th?

Query - Write a query to display total number Section in student detail. ?

 

 

Ø  Deleting Records

Query - Write a query to delete all sec c student?

Delete * from student where sec='c'

Query - Write a query to delete all fail student?

Query - Write a query to delete all Female?

Query - Write a query to delete all Percent less then 40?

 

Same do for male, class, Percentage, etc,

Query - Write a query to Update section A for sohan student.

Update student SET sec ='A' where name='Rina'

Query - Write a query to Update Student name RIMA TO REEMA

Query - Write a query to Update Student name RIMA TO REEMA

 

Same do for male, class, Percentage, etc,

 

Ø  Work with Column

To Add Column

Alter table Student

ADD column dob date

 

To Alter Column

Alter table Student

Alter column dob text

 

To Delete Column

Alter table Student

DROP column dob date

 

To Delete data from Column

Alter table Student

Truncate column dob date

 

No comments:

Post a Comment

Tally

  अकाउंटिंग आधुनिक व्यवसाय का आकार इतना विस्तृत हो गया है कि इसमें सैकड़ों , सहस्त्रों व अरबों व्यावसायिक लेनदेन होते र...