0% found this document useful (0 votes)
7 views14 pages

Inbound 1266701907454259617

This document outlines the basics of MySQL, including its learning objectives, components of a relational database management system (RDBMS), and various SQL commands for creating, updating, and deleting databases and tables. It explains the structure of tables, records, and fields, and provides syntax for common operations such as creating tables, inserting records, and querying data. Additionally, it emphasizes the importance of careful data management when using commands that modify or delete data.

Uploaded by

manasvidom17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views14 pages

Inbound 1266701907454259617

This document outlines the basics of MySQL, including its learning objectives, components of a relational database management system (RDBMS), and various SQL commands for creating, updating, and deleting databases and tables. It explains the structure of tables, records, and fields, and provides syntax for common operations such as creating tables, inserting records, and querying data. Additionally, it emphasizes the importance of careful data management when using commands that modify or delete data.

Uploaded by

manasvidom17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

MySQL

LEARNING OBJECTIVES lf!i:


After comple ting this chapter, you will be able to:
--.. learn about data and informa tion.
~ Understand the concept of database management system .
~ Learn components of ROB MS.
,..~ Understand MySQL commands.
~ Create database and table in SQL.

hould use a M~SQL to


oil records, as lt helps
store, retrieve a

~
~~
a, P~~::ishers Pvt . Ltd.
ass
(A relation al databa se is a collecti on of multlpl e tables that could be related
to each othe
consist s of records , which gives informa tion about the items in the table.
A record consistsr. ~ ta~
which contain informa tion about the record ) RDBMS lets you create, 0
update and adrnin• ri,~
1ster
relation al databa se.
a~
Components of RDBMS
A relation al databa se has the followin g major compo nents.
Table
(Tables are the places where all the informa tion in your databa se is storec:V
They have to be creat d
are used to keep t~e ~~t
no other part of the databa se can functio n until the tables are created Qables
tabulat ed in rows and column 's)
Here we have a table, i.e. STU D ENT with 7 column s and 5 rows (includ ing
headin g).
STUDE NT
Roll No Students Name Class English Hindi M aths Total
1 Rahul Singh X-A 70 65 95
2 Priya Gupta X-A 82 75 85
3 AlokJai n X-A 66 90 80
4 Payal Shina X-A 75 80 75
Record
(A record is a row in a table that ~ntain s informa tion about a given person
, produc t, or a n event. It
also known as row , entity or t uple.)
In the table given below, you can see the highligh ted row incorpo rates
the data of all the field s and !
called record. Similar ly, all the other rows also contain the data of column
s of table.
STUDE NT
Roll No Students Name Class English Hindi Maths Total
1 Rahul Singh X-A 70 65 95

Reco,d,_§ 2 Prlya Gupta X-A 82 75 85


3 AlokJai n X-A 66 90 80
4 Payal Shina X-A 75 80 75
Field
{A field is a column in a table that contain s a specific piece of informa tion
within a record. It ,s e
th
smalles t unit of data . It is also known as a column or attribu te'\
_:.:.; ,a
In the below table given below, you can see the highligh ted column
s (English , Maths) contJ
particu lar class of informa tion and are called fields. Simllar ly, Studen ts Name, 01
Class, etc. are the fields
the table.
STUDE NT
Roll No Students Name Class Engllsh Hindi Maths Total
1 Rah ul Singh X-A 70 6S 95
2 Prlya Gupta X-A 82 7S 85
3 Alo kJaln X-A 66 90 80
4 Payal Shina X-A 75 80 75
,Access,
I There are many RDBMS softwar e availab le. Some of them are Oracle, Visual
libreOf fice Base, MySQL, etc.
Foxpro, Microsoft

~ A. PM Publish ers Pvt. Ltd .


14 LE Q JU
e,stand this
1,1s un
d
. hour example.
d After naming th e table Members the columns are all listed
tel,.,een braekets () in, t. e or er that they will appear in the table (left-to-right).
' Each column name,
bet""'a separated' is assigned a data type that rimits
· (or not) the type and amount of data that can be
,om
s.tored,we assign a co Iumn name Member_lD and give it a data type of INT, which sta nds for integer,
f1' st' ·ng that only integers (numbers between -2147483648 and 2147483647) can be stored in this
fllean1
,01umn,ond . column Activities both have a column name followed by a
column Member_Name and third
these C
data type .
of VARCH~R~)- This data types allows "va rious characters" (letters, numbers, spaces,
,
tuation etc.) but limits the number of characters to the number specified between parenthesis. The
punc '
Member_Name, for .
example, can be up to 100 characters long, but If the name exceeds this limit, it will

not be stored properly.


.,. we assign the fourth column name Charges and give it a data type of INT, which stands for integer.
Ne~,,
The r,nal detail is not a column. A primary key is a unique index used to identify the rows in a table.
Evel'/ table should have one primary key. in our example, this makes the Member_ID column for the

primarv key column.

Showing Tables
After creating the table, let us look at the list of tables you have created in your database.

Syntax:
SHOW TABLES;
1. In mysql> prompt, type SHOW TABLES;.

2. Press the Enter key.


• You can see a list of the tables (members) that have been
created in the current database (Sports_Club).

Describing Tables
You can view more detailed information about each table by using DESCRIBE or DESC command.

Syntax:
DESCRIBE table_name; or OESC table_name;
1. In mysql> prompt, type DESCRIBE Members;.

2. Press the Enter key.


• As you can see, all necessary table information is listed
for reference when a table is described.

Altering Table . . .
The ALTER . dd d te or modify columns in an existing table.
I
TABLE statement Is used to a , e e ,
ADo COLUMN
To add a column in a table use the following
· syn tax.·
Svntax: '
ALTER TABLE table name
A -
DO column_name datatype; IT PLANET - 8 (CodeAI Plus) A~
Dropp ing Database
The DROP DATABASE statement is used to delete an existing database .
Syntax:
DROP DATABASE database_name;
Note: Be careful before dropping a database. Deleting a database will result in loss of co
information stored In the table in a database rr,p/,..
.,.
1. In mysql> prompt, type DROP DATABASE Sports_Club;.
2. Press the Enter key. It will delete the database from the list.

CREATING TABLE
Before creating table in MySQL you must create database and use it.

ISports_Club !- - - -- - - - Database
I
Members +-- - - - - - - - -Table
FleklName Field Type Description
Member_lD Integer !INTEGER)
Member_Name Text [VARCHAR)
Activities Text [VARCHAR]
Charges Integer (INTEGER)

Creating a Table
The CREATE TABLE statemen t is used to create a new table in a database.
Syntax:
CREATE TABLE table_name (
columnl datatype,

column2 datatype, I
1
rt@s1+ i;;\,t·[email protected]~
column3 datatype, While naming field/column in MySQL, don't use
period (•) forward slash ( / ), comma (,) etc.

);
The table_name specifies the name of the table.
The column parameters specify the field names In the table.

The datatype parameters specify the type of data the column can hold (e.g. varchar, integer,
date, ~id-
. ' . '
1. In mysql> prompt, type
CREATE TABLE Members
(
Member_lD INT,
Member_Name VARCHAR(lOO),
Activities VARCHAR(lOO),
Charges INT,
PRIMARY KEY (Member_lD)
);

,s
~ PM P,bUshers Pvt. ltd .
2. Press the Enter key.
• Query OK message appears.
Syntax:
UPDATE table_name SET fleld_change=value WHERE field_ criteria=value;
You need to specify which table needs updates, and which column(s) in the table needs Updat
e. lo
update the charges whose Member_lD is 2, follow these steps.
1 1. In mysql> prompt, type
UPDATE Members SET Charges=sooo
WHERE Member_lD=2;
2. Press the Enter key.
• Query OK, message appears.

View Updated Records in Table


After updating data into your table, you can view that data using SELECT statement.
1. In mysql> prompt, type
SELECT • FROM Members;
2. Press the Enter key.
• Your updated record appears in the
table.
In this example, we have updated the
charges from 2000 to 5000 where
Member_lD 2.

Using Delete Command/ Statement


When a record or row in a table is no longer necessary, you can remove it using the DELETE statement.
Sy ntax:
DELETE FROM table_ name WHERE column=data;
To delete the row whose Member_lD is 3, follow these steps.

l. In mysql> prompt, type


DELETE FROM Members WHERE
Member_lD=3;
2. Press the Enter key.
• Query OK, message appears.

View the Table After Deleting Record


After deleting record into your table, you can check it using SELECT statement.
1. In mysql> prompt, type
SELECT • FROM Members;
2. Press the Enter key.
• Your table appears without the record
you have deleted.
In this example, we have deleted the
record whose Member_lD was 3.

NOTE: Take care not to d elete too much o r t he wro ng d ata w hile using DELETE co m m and .

~ 70
PM Publishers Pvt. Ltd.
r,tYSOL QUERIES querying a database is one of
st for a specific data fro~ -~ -: fatabase. The cap abi lity of
auerv is a reque ery is sim ply a question rep
resented in a way
ture s. In oth er wo rds , a Qu
the- most pow erf ul databa se fea to find the answer to a question, you
wall l'lave to
ers tan d. If you wa nt
that database progr~m can und ry has been created, you can
run it to get the desired
que ry firs t. On ce you r que
cr"eate a corresponding
informat ion.
em en t
Using Se lec t Co mm an d/ St at most applications,
of fiel ds you wa nt to ext ract from a certain table. In
set
The SELECT command lists a ge (DM L) command.
ECT is the mo st com mo nly used Da ta Ma nip ula tio n Langua
SEL

View Records in Table


a using SELECT sta tem ent .
r ins erti ng dat a into you r table, you can access tha t dat
Afte
Syntax :
SELECT • FROM table_name;
query wo uld display all
l wild car d tha t allo ws you to display all the fields. This
The asterisk (•) is a specia
the fields for all the rec ords.
1. In mysql> prompt, type
SELECT • FROM Members;
2. Press the Enter key.
s in the table.
• Your inserted records appear
:I I , / ' ', ','

Using Where Clause nd to get the record s (values) wh


en the spe cifi ed
wit h the SEL ECT com ma
You can use the WHERE clause
condition is fulf ille d.
Syntax :
WHERE con diti on;
SELECT • FROM tab le_ nam e , foll ow these steps.
ail abo ut the 11st of me mb ers whose activity is Badminton
To get the det
1. In mysql> prompt, type
ERE
SELECT • FROM Members WH
Activities= 'Badmlnton';
2. Press the Enter key.
the
• Query is created and it displays
e type of
records containing the sam
values (Badminton).

nd or sta tement.
h UPDATE and DELETE comma
WHERE clause is also used wit
em en t
Us ing Up da te Co mm an d/ St at a. The UPDATE statemen
le, you nee d to cha nge or upd ate you r data wit h new dat
Sometime In you r tab
is used for this purpose. 69
IT PLANET - 8 (CodeAI Plus)
1. In mysql> prompt, type
ALTER TABLE Members
ADD Timing TIME;
2. Press the Enter key.
• Query OK message appears.

When you again describe the table, its altered structure


appears.
• In this example, we have added one column (Timing) i
the existing table. n

DROP COLU MN
To delete a column in a table, use the following syntax:
Syntax:
ALTER TABLE table_name
DROP CO LUMN column_n ame;
1. In mysql> prompt, type
ALTER TABLE Members
DROP COLUMN Timing;
2. Press the Enter key.
• Query OK message appears.
When you again describe the table, its altered structure appears. It will remove the column
(Timing).
Inserti ng Records in the Tables
After creating the table by building the structure, next step is to insert the records
to it. INS\9

D
statemen t is used to add one record at a time.
Syntax :
INSERT INTO Table_name
VALUES ('val_colu mnl', 'val_colum n2', .... ............. , 'val_colu mnN');

1. In mysql> prompt, type


INSERT INTO Members
VALUES ('1', 'Akash', 'Cricket', '3000'};
• Query OK message appears. 2. Press the Enter key.

By using INSERT statement, you can add more records to the table.

Droppi ng Table
The DROP TABLE statemen t is used to delete an existing table.
Syntax:
DROP TABLE table_name;
Note: Be careful before dropping a table. Deleting a table will result in loss of complctt!
in'
stored In the table/

1. In mysql> prompt, type DROP TABLE Members; .


2. Press the Enter key. It wlll delete the table from the database.

~ Q PM Publishe,s Pvt. ltd. I


RSA'l'ING DATABASE
C create a new database and fill data in it. ~
you can
tinQ a New Database
crea
The CREATE DATABASE statement is used to create a new database.

syntax:
CREATE DATABASE database_name;
The database_name specifies the name of the database.

• ! ' •
· . 1. In mysql> prompt, type CREATE DATABASE
Sports_Club;.
2. Press the Enter key.

■ MySQl.8.0 Command Line Oient • If the command for creating database is OK then
Query OK, appears.

• mysql> prompt appears for next command.

Showing Database
After creating the database, you can see it in the database list. The SHOW DATABASES statement
is used to show the name of new database.
Syntax:
SHOW DATABASES;
1. In mysql> prompt, type SHOW DATABASES;.
2. Press the Enter key.
• This command will show alphabetical list of
the databases that you have access to.
• Your newly created database (sports_club)
also appears in the list.

Using Database
Now that your database is created, you have to select it for use.
Syntax:
USE database_name;
• ~I.O'--ci Line Olene 1. In mysql> prompt, type USE Sports_Club;.
2. Press the Enter key.
• Database changed message will appear.

IT PLANET - 8 {CodeAI Plus)


d to modify the databas e tables. Here are some
Data Manipul ation Language (OML): It use
comm~
that come under DML:
• INSERT : Used to insert data Into the row of a table
• UPDATE : Used to update or modify existing value of the table data
• DELETE : Used to remove one row or more rows from a table
. It is used to grant and take back authorit y from any database user u
Data Control Language (Del) ·
· 11
are some commands that come under DCL:
• GRANT : used to give user access privileges to a database
• REVOKE : Used t o take back permissions from the user
Transactional control Language (TCL): It can only be used with DML comman ds like
INSERT, DELETE
UPDATE only. Here are some commands that come under TCL:
• COMMIT : Used to save all the transact ions to the database
• ROLLBACK : Used to undo transactions that have not already been saved to the database
• SAVEPOINT : Used to roll the transact ion back only to a certain point
Data Query Language (DQL): It is used to fetch the data from the databas e. It uses only
one comman
• SELECT : Used to select the attribute based on the conditio n describe d by WHERE clause

Data Types
In ~ table: each field has a data type that defines what you can store in it. Data entry
is restricted
vahd entries for the type you choose. For example, you cannot enter letters in a field set
f
to Numbj.
The following are the available data types:
• INTEGER : It is a whole number (no decimal) .
• CHAR (SIZE): It holds fixed length string. It can have a maximu m size of 255 characters.
• VARCHAR (SIZE): It holds variable length string. It can have maximu m size of 65535 characte
rs.
• DATE: It can have values in YYYY/ MM/00 format.
• TIME: It can have hour, minute and second value in HH:MM :SS format.
• TIMESTAMP: It can have year, month, day, hour, minute and second values.

,-·-·-·
i
-·-·-·-·-·-·-·-·-·-·-·-~~
ry,g ,t,

MR I fir, t p ·-·- ·- ·- ·-·-·-·


- ·~ f:Mt!illMii!i®
-·-·-·- ·- ·-·-G ~
~~~"1

·
Field Name Data Type
i
Predict t h e appropria te data type for the following fields In the Exam table:
I
Exam Time
Fleld Name Data Type iI
Exam Date
Exam_SubJect - I
Student_Age
Student_ Name I
-
, Student_ Photo
- l
·- ·-·- ·- ·- ·- ·-·- ·-·-·- ·-·- ·- ·- ·-·- ·- ·-
·- ·- ·- ·- ·- ·- ·-·-·-· -·- ·- ·-·-·-· - ·-·'
'-0
~ PM Publisher s Pvt. Ltd.
l d t b
r,ffS~~e ofStr the mo st po pu lar rel atio na ma na ge me nt so ftw are tha t is
\'\ .
ge It :sad as~ ~0
SQ
rvwsaL ~ SOL - uct ure d Qu ery Lan gua Oracle M
le ~ eve op ed and supported by Y •
based o . MySQL sto res da ta in tab s ma e up of rows and columns.
corp oration.
g M yS Q L
oo wn loa din g an d In st al lin n sof twa re. Here, you wil l
nit y server ed itio
cia l we bsi te of MySQ L ao d do wn loa d the com mu
Go to the offi Windows.
t o cho ose the Op era tin g System, such as
see the opt ion atio n process.
th ip it an yw he re and double-click file to sta rt ins tall
After downloading e se tup file , unz
ing MySQL.
ctio ns wh ile ins tall
care fully foll ow all the ins tru

Starting an d Ex iti ng M yS Q L n ope n you r MySQ L Command Line Client. It


sho uld
sfully installed, you ca
once MySQL has bee n succes
appear with a mysql> pro mp t. left of Sta rt menu.
nu app ear s. A list of all the installed opps app ears on the
Sta rt me
1. Click on Start Icon.
SQL.
2. scroll down and click on My
Line Cli ent.
3. Click on MySQL Command En ter the password tha t you
4.
have cre ate d at the tim e of
ins tall atio n.
5. Press the En ter key.

No w you wil l see som e


ow ed
intr odu cto ry info rm atio n foll
by a my sql > pro mp t.
• The my sql > pro mp t tell s you
tha t mysql is rea dy for you
to ent er SQL sta tem ent s.

Exiting M yS QL 1. In mysql> pro mp t, typ e exi


t.
2. Pre ss the Enter key.

MYSQL COMMANDS use d to com mu nic ate wit h the da tab ase. Th
ese com ma nd s are
wh ich are
Commands are ins tru ctio ns da ta to tables, dro p the tab le, mo
dif y the tab le,
ks like cre ate a tab le, ad d
used to perform var iou s tas rm' var iou s fun cti on s:
, etc . My SQ L use s the fol low ing com ma nd s to pe rfo
set Perrnfsslon for us ers ng a tab le, etc.
use d for cre atin g a tab le, de leti ng a tab le, alt eri
(OOL): It is
Data Definition Language
t com e un de r DDL:
Here are some co mm an ds tha
ne w tab le in the dat aba se
• CREATE : Used to cre ate 3 abase
ed to alt er or cha nge the str uc tur e of the existing dat
• ~TER : Us
red in the tab le
the str uct ure an d record sto

PlusA ~
op : Used to de let e bo th
• DR

IT PLANET - 8 (Co deA I


INTRODUCTION ry or any
ization whet her it is a scho ol, hosp ital, shop, facto
Nowadays, data is very impo rtant for any organ
,
th ese organizations require efficient database management softw are to enter
other establishment. All
database
th study about MySQL which is an open source
store and manage data. In is chapter, you will
management syste m.

oata and Info rma tion


audios,
s, which can include text, numbers, images,
oata is a collection of unprocessed facts and figure
and videos.
ments,
ized, meaningful, and useful. In addi tion to docu
Information is processed data; that is, it is organ mmu nicat ion can
information can be in the form of audio , images, and/ or video. For example, voice co
ber or frien d to hear.
be sent in an e-mail message for a famil y mem

Train, 9:00 AM,


0
oro Delhi, Mumbai ~ What can you ffgure out from this?

AM, or the train will


The train will depa rt from Mumbai to Delhi at 9:00
depa rt from Delhi to Mumbai at 9:00 PM.
ar way, data
syntax convey ambiguous meaning. In a simil
As we can see, words exclu ding grammatical the form
after processing by the comp uter, data takes
on its own has no meaning or context. It is only
of information .
Concep t of Database Man age men t System
arises for
organization and it grows day-by-day, so a need
As we know that data is a prim e source of any
anism
large collection of data and also provides mech
some tool that aids in main tainin g and managing
data set.
for systematic extraction of infor mati on from large
use of
manner that allows easy access, retrieval, and
A database is a collection of data organized in a
that data.
te a
ase management system (DBMS), users crea
With database software, often called a datab
and crea te
e data in it; sort and retrie ve data from it;
computerized database; add, modify, and delet
forms and repor ts from the data in the database.

Eumple of Database
ories and subje cts in II .
A school library stores books of diffe rent categ
each shelf. Therefore,
different shelves with a name assigned on
cular book, they can
Whenever anyone requ ires to search for a parti
easily locate.
In a similar manner, all the data is well-organ
ized in a tabu lar form in
pulated and upda ted
DBMS so that it could be stored, accessed, mani School Library
easily When required.
S)
Relational Database Man age men t System (RDBM
s
gement System. It is simil ar to DBMS that store
~DBMS is an acronym for Relational Database Mana
information in the form of relat ed tables.

IT PLANET - 8 (CodeAI Plus)


CttECKLIST
reading tine chapter, I know these points· Disagree
ARer ·
• tabase Is a collection
f h ofd data organized In a manner that a11ows easy access,
Da
retrieval, and use o t at ata. CJ 0
Tables are the places where all the Information In our database Is stored. CJ 0
, Record is a row In a table that contains Information about a given person,
product, or event. CJ CJ
, field In a column in a table contains a specific piece of Information within a
record.
CJ CJ
, MySQL is one of the most popular relational database management software that
Is based on SQL - Structured Query Language. CJ CJ
• MYSQL uses the ODL, DML, DCL and TCL, DQL commands to perform various
CJ CJ
,
functions.
Each field has a data type that defines what we can store in it. CJ CJ
• Query is a request for a specific data from a database. The capability of querying
a database Is one of the most powerful database features. CJ CJ
• SELECT command or statement lists a set of fields we want to extract from a
certain table.
CJ CJ

-------------•·ij»tN.W!JIIID
..,__,__.... ·•---------------
A. Tick (✓ J ther correrct answerr.
......... ....... are used to keep the data tabulated in rows and c ~
1.
a. Record CJ b. Table ~ c. Field
0
2. .. .............. is used for creating, deleting, altering a table.
a. DDL ~ CL O c. DQL
0
3. .. .............. is used to grant and take back authority from any ~ s e r .
a. DCL O b. TCL ~ c. DML 0
4 Th t I ed to add, delete, or modify columns Is an existing table.
• e ............... statemen s us
a. SHOW TABLE O b. CREATE TABLE O c. ALTER TABLE
S. By usi..g statement you can add one records at a time.
a. INS~R;............... ~ SELECT O c. UPDATE

B. Writer 'T' for Truer and 'F' for falser statermcints.


1. RDBMS is an acronym for Relational Database Management System.
2. CHAR data type can have a maximum size of 300 characters.
th
3· The Field parameters specify the field names In e table.
4· Every table should have one primary key.
S. Query Is a request tor a specific data from a database.
r
C. FIii In the blan ks.
1. WHERE clause is also used with
and .tJ.fdo:J.~...
com man d. .0.el.e/:f....
2 . ...l.~.fu .... is processed data that is, it is organized , mea
ning ful, and useful.
3. A rational database is a colle ction of mult
. iple ... that could be related to each oth lo.bl.~ ..
4. ..T..1.~.e .~ ,.. can have hour, minu te and seco ~
nd value.
s. The ....... ........ ..... specifies the name of the database .
D.

E.
Information

pf Data Definition lang uage


Data Manipulation Language

f. Ans w,u In 1-2 svnt vnce s.


yw rite the full form of RDBMS.
................................. ................ ............................................
.............. ....................... ..................... ' .

········ ··············· ····························· ·······················-····· ········


···························································.

I
••····· •• •••••h• • •••••••• •••••••• •••••••·
•• • ••••·•• • •··• • •••••••• •· • • ·• ••••• •
• · • ••o•••• •••••• ••••oo OO OO OOo,oo• • •···••
•••• OOOO•oo ••••• •··• •• ••• • I• •• •
........ ............................................ • 0

·············· ········ ······· ································································


~ a r e MYSQL queries? ···•"
···································· ······················· ········ ·······················
······················ ·······································
·····························································································
a. ·················································· ·········
Answer brld ly.
✓eriefly explain relat ional database manageme
nt syste m.
····················· ················ ········ ········ ·· ······· ······· ·······················
········•····· ············································
························ ····································· ················· ···········
········ ··············· ·············· ·················•"'
·············· ········ ······· ···························· ······························
······························ ······· ····················· ·····
a
~ r ite the steps to create a new database.
...............................
·········· ·········· ···········································:········•.......... .................................................
······················-··········-············ ········· •· .. ·················································· ······································
.......... ··········
·········· ··· ................................................................................................
............................. ............................ .
/ Write about the compo nents of RDBMS.
·········· ······················
···················· ······································ ·········· ·········· ···················· ···················•o0 ••········
.......... ...... , ............................ .............................. ....... , ................. , .. , ....................
........, .......... .... ···················
.................. ......... ...
........................................................................................................................................
Critica l Think ing Skill • •
llppUcatlon-bosod Ouostlon a;
~- fields like Studen t_nam e, Class,
Shrcim has made a database t able in SQL contai ning the (!) ·
field 'Stude nt_nam e'. Has he
Roll_No and Conta ct_No , He has set the prima ry key for the
Give reason .
done t he right thing by settin g the prima ry key for this field? Animati on

,s~:;·}:/;J:j!J~:!·~~d
f!qf lfv... ~f · f '"ei~ m
0
m .,110+
ii/•lififHjffi\) b, u~ ue
Divide the studen ts Into groups and d iscuss t he Impor tance of
query In the database. W
~ ¼e- .-e CG!Vl be Mk, c:.-lo cle,
~.0' 1 f' -
~ e
r+1,,,, ¼ e
,h
""1

Online Link
To learn more about Image s, links and tables in HTM L, visit
the website:

https:/{w ww.w3 scho o Is. com/s q 1/

Lab Activity
1#1$1ili•iiuhhf.i,t-- j
This activi ty enhan ces data organ izatio n
and mana geme nt skills of the stude nts.
Creat11 a datab asCl with thCl follow i ng tablcr In SOL. -- -

Write SQL comm ands to:


No

l
N1111e Aae Gender
J 1. show all inform ation about female
students.
Rishabh 15 M 2. update the record of Aarav to chang e his
age t o 17 and view the update d record in
2 Aarav M
16 table.
3 3. Insert a new record w ith the follow ing data :
Himan l 14 F
(6 , "Jaya", 18, "F")
4
Blnit 15 M 4. add a colum n to display date of birth of all
the students.
5
Abhaya 17 F 5. show the records of each studen t with age
>15

IT PLAN ET - 8 (Code AI Plus)

You might also like