0% found this document useful (0 votes)
6 views187 pages

CHR 5,6,7,8,9

The document provides an overview of web designing using HTML, covering topics such as creating hyperlinks, lists, tables, framesets, forms, and JavaScript. It explains various HTML tags and attributes, as well as control structures and data types in JavaScript. Additionally, it discusses web hosting types, including shared, dedicated, and virtual hosting, and highlights the significance of responsive web design for modern devices.

Uploaded by

ak2user222
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)
6 views187 pages

CHR 5,6,7,8,9

The document provides an overview of web designing using HTML, covering topics such as creating hyperlinks, lists, tables, framesets, forms, and JavaScript. It explains various HTML tags and attributes, as well as control structures and data types in JavaScript. Additionally, it discusses web hosting types, including shared, dedicated, and virtual hosting, and highlights the significance of responsive web design for modern devices.

Uploaded by

ak2user222
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/ 187

WEB DESIGNING

USING HTML
? Write HTMLtag for the following

~
(a) Hyperlink to the website http://www.dhsekerala.gov.in
-

-(b) Email link to [email protected]


-
Creating links
A hyperlink is an element, a text, or an image in a web page that we
can click on, and move to another document or another section of the
same document.

→Using tag <a></a>


--
-
→Href is the main attribute of <a> tag.
→Href value of this attribute is the URL of the document
(address of the web page/site) to which hyperlink is provided.

--
-
Internal linking
A link to a particular section of the same document is known as
internal linking.
→The attribute is Name

-
External linking
The link from one web page to another web page is known as external
linking.
→Use URL of the external file.

- -
Creating graphical hyperlinks
Make hyperlinks to images also using <img>tag inside the <a>

--
~ -
-
-
Y
X
- - -


Creating e-mail linking
We can create an e-mail hyperlink to a web page using the hyperlink
protocol mailto:
-

--
-- -



? Explain about various kinds of lists in HTML with example
Lists in HTML
1.Unordered lists
2.Ordered lists
3.Definition lists
↓ ↓
1.Unordered lists
→also called bulleted lists
-

→Display a bullet or other graphic in front of each item in the


list.
→ tag pair <ul>and</ul>
--
→items are placed between the tag <li> and </li>
- -


<ul
-
type=“value“>
- (baT
<li>item1</li>
-
cimgT
<li>item2</li>
……………………
…………………… -
<li>item n</li> -
</ul>

T
Type attribute have the values
-
1. Disc (default value).
-
2. Square. -
3. Circle.
-
-
-
-
~
-
-
-
-
-

-
-
2.Ordered lists
Ordered lists present the items in some numerical or
alphabetical order.
→ tag pair <ol>and</ol>
--

→ items are placed between the tag <li> and </li>


-
-
<ol type=“value“>
-
<li>item1</li> f

<li>item2</li> -

……………………
…………………… S

<li>item n</li>

--
</ol>
→Type and Start attribute.
Type attribute, which can set with the values as detailed below:

1 Default numbering scheme (1, 2, 3, ...)


A Upper case letters (A, B, C, ...)
a Lower case letters (a, b, c, ...)
I Large roman numerals (I, II, III, ...)
i Small roman numerals (i, ii, iii, ...)
=
T
-

-
-
-

- -
-
-

-
3.Definition lists
A definition list is a list of terms and the corresponding
definitions
→ tag pair <dl>and</dl>.
-
Y
→ for Title use the tag <dt> and </dt>.
--
→ for definition use the tag <dd> and </dd>.

g
-
-
>
-

-
-
- -

- -
Y
T

T
<dl>
-
y <dt>head</dt>
<dd>definition</dd>-
……………………
……………………
<dt>head</dt> -
<dd>definition</dd>
</dl>
-
? Write HTML code to display the following table in a
webpage

- -
-
-
-
-

-
-

-
-

& - -
-

- -
Creating tables in a web page
→<TABLE> </TABLE>tag is used to create tables.
-
→consists of rows and columns of cells.
→<TR>,<TH> and <TD>
-
--
- -- -

-
- -

[ -
-
[ -

[
-
-

-
2 -

[ -
Attributes of <tr> tag

-Align
Valign(specify the vertical alignment of the content in a cell)
~
(“possible values are top, middle, bottom or baseline.”)
----
Bgcolor
-
- -
-

-
-
Attributes of <TH> and <TD>
Align
-

Valign
-
Bgcolor
-
Colspan (need columns occupying more than one cell)
-
Rowspan (we can make it span multiple rows)
-
[ -

[ -

·
? Write a short note about frameset.
Dividing the browser window
Sometimes we need to include more than one webpage
inside a single browser window.

→ Using <frameset>
- -
and </frameset> and
also use <frame> and </frame> .
--
<frameset> tag
main attributes are:

E
Cols: (determines the number of vertical frames in the frameset
page and its dimensions)
Rows: (defines the number and dimension of horizontal frames. )
Border: (pecify the thickness of border for the frames)
Bordercolor: (specify border colour)
<frame> tag
→ It is an empty tag and it defines the frames inside the
<frameset>.
attributes :-
- Src:
Scrolling:
-
a
Noresize:
Marginwidth and Marginheight:
-
Name:
-
- - --

-
~

%

IJ
framel Intrut
: 20
-
%
feamed . Html 0
-
html 50 %
fames .
Write an HTML code to display a user registration
form as shown below:

- ~

- -

-
&
-

-
=

-
Forms in web pages
HTML Forms are required when we have to collect some data
from the webpage viewer for processing.
→<form>
-
and </form>
attributes of <form> are:
~
Action: It specifies the URL of the Form handler, which is ready
to process the received data.
~Method: It mentions the method used to upload data. The most
frequently used Methods are Get and Post.

-
Target: It specifies the target window or frame where the result
of the script will be displayed. It takes values like _blank,
_self, _parent, etc.
The main values of Target attribute are given

-
-

-
Form controls
-----
Text box, Password, Check Box, Radio Button, Text Area, Select Box,
Submit and Reset Button.

→ <input> tag.
-
<input> tag
Attributes:
Type:
- -
~

-
-

-
select
A select
-
box, also called dropdown box, provides a list of
various options in the form of a dropdown list.
-

<select>
~ <option> item1 </option> ~
<option> item1 </option> -
<option> item1 </option> -
………………………………..
………………………………..
-</select>
-Name: It gives a name to the control, which is sent to the server to
be recognized and to get the value.

~Size: This can be used to present a scrolling list box. Its value will
decide whether the select box should be a drop down list or a list
box. If the value is 1, we get a dropdown list (or combo box).

Multiple: It allows users to select multiple items from the menu.


-
CLIENT SIDE SCRIPTING
USING JAVASCRIPT
? Briefly Explain the different ways in which a JavaScript
can be inserted in a web page
There are three ways to insert JavaScript in a web page.
- 1. Inside <head>As the body section of the HTML page contains
-

large volume of text, this is said to be the best practice. This avoids
the confusion of web designer.
- 2. Inside <body>
-
Here, the script will be executed while the
contents of the web page is being loaded.
- 3. As an external JavaScript file with explanations – Here, the
.js file is linked to the HTML file as an external file.
? Explain the use of for loop with an appropriate example.
- D
3. for loop

-p
for(initialisation; test_expression; update_statement)
{
statements;
}
=
10
12
10
- 1 L:
=
2
2 Ex
=
=
-

-
-
-
-

--
t
= 10

ii
4. while loop

if
while (test_expression)
{
statements;
}
10
=
2
10
2 =
i= 4
H
=
6

-
Op
~
-
-

2 -
i+ =

=> i = i + 2
? Develop a webpage that implements a JavaScript
function that takes two numbers as input and displays their
product.

function product ( )
-- nurnt
{
var num1, num2, num3 ; x
num1 = Number ( document.frm1.txt1.value ) ;
..
-----
num2 = Number ( document.frm1.txt2.value ) ; da
----
num3 = num1 * num2 ;
document.frm1.txt3.value = num3 ; ro
&
↑ My
} -
Creating functions in JavaScript
→A function is a group of instructions with a name
→JavaScript has a lot of built-in functions that can be used
for different purposes.

-
-

→JavaScript uses the same rules for naming identifiers as in


C++.
→It must be called for its execution.
The function can be called by using the function name as follows:

print();
-
-

---

→ Not executed
-

-
---
>
-

-
-
→ Line function function_name() is called the function header
→ The code within the braces { and } is called function body
→ In JavaScript no return type -
-
→ Function can define on header section but It is not necessary

"S
-
-

--
I
-
? Write the names and their use of any two built in functions in
javascript
Built-in functions

a. alert() function
b. isNaN() function
c. toUpperCase() function
d. toLowerCase() function
e. charAt() function
f. length property
~
alert() function
This function is used to display a message on the screen. -

alert(“Welcome to JavaScript”);
-

-isNaN() function

-
--
toUpperCase() function
- var x, y;
x = “JavaScript”;
y = x.toUpperCase();
-

alert(y);
-

toLowerCase() function -

y = x.toLowerCase();
-

alest (4)
charAt() function
var x; -
0123456789
x = “JavaScript”;
-

y = x.charAt(4);
-

alert(y);
length property
var x, n;

#11/I
x = “JavaScript”;
n = x.length;
alert(n);
-
? Explain about any two control structures used in
javascript with example
6. Control structures in JavaScript

Control structures are used to change the sequential flow of


execution in a program.
1.if
2. switch
3. for loop
4. while loop
1. If

N A

C
- -

-
-

-
35
=

score

C -

-
-
2. switch
switch (expression)
--
{
& case value1: -
-

statements; -

break; -

case value2: -
-

statements;
-

break; -

.................
.................
default:
statements;
}
--
di

j
--
? Explain any two data types in JavaScript.
Data types in JavaScript
The three basic data types in JavaScript
~
1.Number
~
2.String
~3.Boolean
~
Number
All positive and negative numbers, all integer and float values (fractional
numbers) are treated as the data type number.
~String
Any combination of characters, numbers or any other symbols, enclosed
within double quotes, are treated as a string in JavaScript
-

Eg:”Kerala”,”abc4”
Boolean
~
The values true and false.
WEB HOSTING
Distinguish between shared hosting and dedicated hosting
Different types of hosting packages:-

-a) Shared hosting


-b) Dedicated hosting
c) Virtual hosting
-
a) Shared hosting
→It is the most common type of web hosting.
-

-→Many different websites are stored on one single web server and they share
resources like RAM and CPU.

→Shared
- hosting is most suitable for small websites that have less traffic.

→Shared
~ servers are cheaper and easy to use

→The updates and the security issues of the software installed in the web
T server are taken care of by the hosting company itself.
Drawback:-
The bandwidth is shared by several websites, if any of these has a large volume
-

of traffic, it will slow down all other websites hosted in the shared server.
-

-
-
b) Dedicated hosting
→Dedicated web hosting is the hosting where the client leases the entire web
server and all its resources.

→Websites of large organizations, government departments, etc.


-

where there are large numbers of visitors, opt for dedicated web hosting.
“The client has the freedom to choose the hardware and software for the server
and has full control over the web server”
→ Servers are usually hosted in data
-
centers where the service provider
facilitates Internet connectivity, round-the-clock power supply, etc.

-→ The technical expertise for managing web servers.

→ The bandwidth is not shared with other websites.

- → It speeds up the access of the website.

“If the client is allowed to place their own purchased web


-service providers facility, then it is called co-location.” server in the
-
c) Virtual hosting
A Virtual Private Server (VPS) is a physical server that is virtually
partitioned into several servers using the virtualization technology.
Each VPS works similar to a dedicated server and has its own
separate server operating system, web server software and packages like e-
mail, databases, etc.
VPS hosting provides dedicated bandwidth to each website on the
server.
Some popular server virtualization softwares are:-
VMware,
-
Virtualbox, FreeVPS,
- Usermode Linux,
Microsoft Hyper-V, etc.
-

-
---
- -
-

-
What is Responsive web design ? What is its significance in modern
computing devices?
Responsive Web Design
Web pages are viewed using different devices like Desktop, Laptop,
Tablet or Mobile phone .
Traditional web pages are designed to be displayed in desktops or
laptops. Such web pages are difficult to be viewed from tablets or mobile
phones.
“Designing webpages which are capable adjusting itself according
to the screen size of the device is known as responsive web design.”
Responsive web design can be implemented using flexible grid
layout, flexible images and media queries.
List the factors to be considered while buying hosting space on a
web server

- → Amount of space required.

-→ Supporting technologies needed.

- → The program used in the web page may require windows hosting or Linux
hosting.

-→ Choose between windows server or Linux server according to the programs


used.

-→ Features like database support , e-mail facility,..etc. can also be considered


while choosing the web host.
How to register a website

-Domain name registration


Domain name is registered for creating URL for unique identification
of our website on internet.

Steps for domain name registration


-1. Choose a domain name.

-2. Check for availability of the name using availability checker facility in
websites like WWW.whois.net . These websites check the database of
-

ICANN that contains the list of all the registered domain names.
-

3. Fill -
WHOIS database by giving name, address , telephone number and
- e-mail address. ---
-

-4. Pay annual registration Fee.


DATA BASE
MANAGEMENT
SYSTEM
Explain different level of data abstraction and DATA Independence in DBMS
DATA Abstraction and DATA Independence
The process of hiding irrelevant details from user is called data abstraction.

The data in a DBMS is described at three levels of abstraction.

They are :-
1. Physical Level
2. Conceptual Level/Logical Level
3. View Level
1. PHYSICAL LEVEL
The lowest level of abstraction describes How data is actually
-
stored on secondary storage devices such as disks and tapes.
-

The physical level describes complex low level data structure in


detail.
2. Logical level
The next-higher level of abstraction describes What data is stored in the
database, and what relationships exist among those
-
data.
-

The logical level thus describes the entire database in terms of a small
number of relatively simple structures.
3. View level
Highest level of data abstraction. This level describes the user interaction
with database system. View level is the highest level of database
abstraction and is the Closest to the users
-
-

-
-

-
L

=
Data independence
The ability to modify the -
schema definition (data structure definition) in one level
without affecting the schema definition at the next higher level is called data
independence.
Two types:
~1. Physical data independence.
2. Logical data independence.
-
1. Physical data independence.
~ It is the ability to modify the schema followed at the physical
level without affecting the schema followed at the conceptual level.

-2. Logical data independence


It is the ability to modify a conceptual schema without causing
any changes in the schema followed at view (external) level.
What is a primary Key? What is the significance of primary key in
a relation?
Keys
A key is an attribute or a collection of attributes in a relation that uniquely
distinguishes each tuple from other tuples in a given relation.

If a key consists of more than one attribute then it is called a composite key.
--
Types:-
- 1. Candidate key
~ 2. Primary key
- 3. Alternate key
4. Foreign key
-
~1. Candidate key
It is a minimal set of attributes that uniquely identifies a row in a
relation.

-2. Primary key


It is one of the candidate key chosen to be the unique identifier for
that table by the database designer.
-
3. Alternate key
A candidate key that is not a primary key.

4. Foreign key
- A key in a table can be called foreign key if it is a primary key in
another table.

A foreign key can be used to link two or more tables it is called Reference
key.
-
List and explain different database users in DBMS.
USERS OF DATABASE
-
1. Database Administrator(DBA)
~2. Application Programmers.
-
3. Sophisticated Users.
-
4. Naïve Users
1. Database Administrator(DBA)

The person who responsible for the control of the centralized and shared
database is the DBA.
Responsibilities of DBA:-
~
1. Design the conceptual and physical schemas.
-2. Security and authorization.
-3. Data availability and recovery from failures.
-2. Application Programmers.

Application Programmers are computer professional who interact with


the DBMS through application programs.
3. Sophisticated Users.

Sophisticated Users include engineers,


--
scientists, business
-
analysts, and
other who thoroughly familiar with the facilities of the DBMS.

They interact with the systems through -


their own queries (a request to
a database) to meet their complex requirements.
~
4. Naïve Users
Naïve Users interact with the system by invoking one of the
application programmers that were writer previously .
They are not concerned with or even aware of the details of the
DBMS.
EG:-
Peoples accessing data over the web, billing clerk,….etc

--
Explain relational algebra
Relational algebra
The collection of operations that is used to manipulate the entire relations of
a database is known as relational algebra.
-

These operations are performed with in the help of a special language


associated with the relational model called query language.
-
Fundamental operations in relational algebra are:-
-
----
SELECT , PROJECT , UNION , INTERSECTION , SET
DIFFERENCE,CARTESIAN
- PRODUCT. Etc
SELECT operation
It is used to select rows from a relation that satisfies a given
predicate. The predicate is a user defined condition to select rows of your
choice.

Yn j
To select all the students who are eligible for higher studies.
𝜎Result="EHS" ( STUDENT)
-
-

-
-
-
-
-
PROJECT operation

It selects certain attributes from the table or forms a new relation.

-
𝝅𝑨𝟏,𝑨𝟐,…, An (Relation)
....

Here A1, A2, ..., An refer to the various attributes that would make up the
relation specified.
Example 8.4: Select Name, Result and
Marks attributes in STUDENT relation.
𝜋Name, Marks, Result (STUDENT)
----

x
~
UNION operation
UNION operation is a binary operation and it returns a relation containing all
tuples appearing in either or both of the two specified relations. It is denoted
by 𝑈. The two relations must be union-compatible, and the schema of the result
is defined to be identical to the schema of the first relation. If two relations are
union-compatible, then they have the same number of attributes, and
corresponding attributes, taken in order from left to right, have the same domain.
Note that attribute names are not used in defining union-compatibility.

An
31
=
,

2 5]
AUB
:
S1 ,
6 , 3, 4, 57]
B
- -
-
-

T
# -

-
-
- -

-
- -
-
-
-
-
T -

- -
-
-

ARTS U SPORTS
INTERSECTION operation
INTERSECTION operation is also a binary operation and it returns a relation
containing the tuples appearing in both of the two specified relations. It is
denoted by ∩. The two relations must be union-compatible, and the schema of
the result is defined to be identical to the schema of the first relation.

Si s
Arr
=
22
ARTS n SPORTS
SET DIFFERENCE operation
SET DIFFERENCE operation is also a binary operation and it returns a relation
containing the tuples appearing in the first relation but not in the second
relation. It is denoted by - (minus). The two relations must be union-
compatible, and the schema of the result is defined to be identical to the
schema of the first relation.

51 ,
2, 33 A B
- = E1]
A =

52 .
3,
43
A = 2n]
B =
B-
-

ARTS-SPORTS SPORTS-ARTS
CARTESIAN PRODUCT operation
CARTESIAN PRODUCT returns a relation consisting of all possible
combinations of tuples from two relations. It is a binary operation on
relations, which has a degree (number of attributes) equal to the sum of
the degrees of the two relations operated upon. The cardinality (number
of tuples) of the new relation is the product of the number of tuples of the
two relations operated upon. CARTESIAN PRODUCT is denoted by × (cross).
It is also called CROSS PRODUCT. All the tuples of the first relation are
concatenated with tuples of the second relation to form tuples of the new
relation.
23 = 23 , 43
A S1 ,
= B

(1 , 4) (2 3) (2 23]
G
,
3) ,
,

AXB = (1 . ,
-
-
--

- -
- --
Terminologies in RDBMS
1. Entity
2. Relation
3. Tuple
4. Attribute
5. Degree
6. Cardinality
7. Domain
8. Schema
9. Instance
-1. Entity
An entity is a person or thing in the real world that is distinguishable
from others.
Eg:-
student , school , teacher..etc

-2. Relation
It is a collection of data elements organized in terms of rows and
column. Also called tables.
-3. Tuple
Rows(records) in a table/relation.
4. Attribute
-
Columns in a table/relation
-

-5. Degree
Number of attributes in a relation/table
6. Cardinality
- Number of rows / tuples in a relation/table
~
7. Domain
A domain is a pool of values from which actual value appearing in a
given column are drawn.

Eg:- In STUDENT table Batch attribute have only { Science, Commerce,


Humanities} the values are domain of the column.

3
E
-8. Schema
The description or structure of the database is called Schema , which
is specified during database design.

-
-
-
-
-9. Instance
It is a set of tuples in which each tuple has the same number of fields
as the relational schema.
Advantages of DBMS

- 1. Control data redundancy


2. Data consistency
3. Efficient data access
-
4. Data integrity
5. Data security
-
- 6. Sharing of data

-
7. Enforcement of standards
8. Crash recovery
-
STRUCTURED QUERY
LANGUAGE
Write short notes on any three data types in SQL
Data types in SQL
Data type defines the type of value that may be entered in the
column of a table.
MySQL data types are classified into 3 :-
1.Number
2.String (text)
3.Date and Time
1.Number

The most commonly used numeric data type in MySQL are


-INT or INTEGER and DEC or DECIMAL
-

The stander form of DEC /DECIMAL is DECIMAL(size,D) or DEC(size,D)


-
- -

Size:- Total number of digits the value contain including decimal part
D:- Number of digits after decimal fraction

DEC(5,2) or DECIMAL(5,2)

2.72
3
:
Size 2
Di
2.String (text)

String is a group of characters. The most commonly used string data


types in MySQL are

CHARACTER or CHAR and VARCHAR


-
CHAR VARCHAR
-

Its full name is CHARACTER Its full name is VARIABLE CHARACTER


-
-

The CHAR is a fixed length


-
VARCHAR represents variable length
character data type strings -

- -

It can hold a maximum of 255 It can hold a maximum of 65535


-
characters. -
characters.

Mysql> create table Mysql> create table student(name


student(name CHAR(20)); VARCHAR(20));

Kalbkx
0 12. ......
19

- j
3. Date and Time
MySQL has data types for storing dates and times.
The data type for date is
DATE
The data type for time is
TIME
DATE TIME
The DATE data type is used to store dates The TIME data type is used to store TIME
- - values -

MySQL represents date values in YYY-MM- It shows values in the standard


DD format HH:MM:SS format.
-
-
-
- -

Eg:- ‘2011-01-24’,’2011/01/24’,’20110126’ are


-- -
Eg:- 22:32:45
--
valid format in MySQL
-
& ---
Explain about different components of SQL
Components of SQL
SQL has three components

-1.DDL ( Data Definition Language )


-2.DML (Data Manipulation Language)
-3.DCL (Data Control Language)
1.DDL ( Data Definition Language )

Command Description

CREATE Create a new table, create a view of a table


~
ALTER MODIFY an existing a table , ADD a new
~
-
-
column and also RENAME the table name.
-

DROP Deletes an entire table , a view of a table.


-
2.DML (Data Manipulation Language)

Command Description
-SELECT Retrieves certain records from one or more tables.
INSERT Creates a record
-
UPDATE Modifies record
-
-DELETE Deletes records
3. DCL (Data Control Language)

Command Description

-GRANT Gives a privilege to user.

~REVOKE Takes back privileges granted from user


Write SQL queries based on the table PRODUCT given below

I
-

~ ( a ) Set PID as primary key


-
( b ) Display the Name , Price of the product having highest price.
--

( c ) Change the Name of Supplier “ Exotic Liquids “ to “ Singapore Foods “.


- -

( d ) Delete all products of “ Tokyo Traders “.


-

-
( e ) Display Pname and Supplier of all products in the ascending order of
-
price.
-

- -
-- --

- - -

- -
-

- -
- & -

-
- -

-- - --
- &
SQL COMMANDS
CREATE tables:-
The DDL command CREATE TABLE is used to define a table by
specifying the name of the table and giving the column definitions
consisting of name of the column , data type and size and constraints if any
..etc
Syntax:-
CREATE
--
TABLE <table name> (<column_name> <data_type>
[<constraints], <column_name> <data_type>
-
-
[<constraints],………………………………………………………………………………………………………………………
-
-

………………………………………………………………………………………..);
Rules for naming table and column
~1. The name may contain letters (A-Z,a-z),digits(0-9),under score(_) and
dollar($)
-
symbol. --

-2. The name must contain at least one character.


-3. The name must not contain white spaces , special symbols.
4. The name must not be an SQL keyword.
-
5. The name should not duplicate with the names of other tables in the
- same database.
Eg:- ↓
CREATE TABLE student (adm_no int,name

varchar(20),
- ----
gender Char,dob Date , course varchar(15),f_income int);
------ --

T
ALTER command
“Changing the structure of a table”
It is an operation related to the schema and hence SQL provides a
DDL command ALTER TABLE to modify the structure of a table.
-1. adding column.
~
2. Changing datatype and size existing column(change
the definition of a column).
-
3. Removing the column.
#
3. Renaming a table.
1. Adding a new column

-- -

- -
-

↓ ↓ D
ALTER TABLE student ADD gr_mks INTEGER AFTER dob,
ADD reg_no INTEGER
-
----
-

---
T
2.Change the definition of a column
We can modify the characteristics of a column like datatype like
size and/or constraints by using the clause MODIFY with ALTER TABLE
command.


ALTER TABLE student MODIFY reg_no INTEGER
UNIQUE;
1
---

-
-
-

>
-
-
3. Removing the column.
If we want to remove an existing column from a table , we can use
DROP clause along with ALTER TABLE command.

&
ALTER TABLE student DROP gr_mks;

↑ 44
- -
4. Renaming a table.
We can rename a table in the database by using the clause RENAME
TO along with ALTER TABLE command.

--

ALTER TABLE student RENAME TO student2015;

----
DROP command
“Removing table from a database”
Using the command DROP TABLE command.

---

DROP TABLE student2015;


---
INSERT INTO command
“ inserting data into tables”
The DML command INSERT INTO used to insert tuples into tables.

- - - -

- -


-
- ~
CREATE TABLE student (adm_no int PRIMARY KEY AUTO_INCREMENT,name
varchar(20) NOT NULL,
- -

gender
-
Char DEFAULT ‘M’,dob Date , course varchar(15),f_income int);
--
-

INSERT INTO student VALUES (1001,’Alok’,’M’,’1998/10/2’,’Science’,24000);


---

44
-
-

1

SELECT command
“Retrieving information from tables”
Simplest form of SELECT command:-

&
-
- -
-

-
-

SELECT name, course FROM student;


- -
-
SELECT name, course FROM student;
-
- -
-

- -

-
-
↑ -
-

M
-
SELECT * FROM student;
WHERE clause
Syntax:-

→ Selecting specific rows using WHERE clause


→ Selection is based on some conditions use WHERE clause.
SELECT * FROM student WHERE gender=‘F’;
&

-
-
-
---
SELECT name, course, f_income FROM student WHERE course=‘science’
AND f_income<25000; -
-

-
-
SELECT name, course, f_income FROM student WHERE NOT
course=‘science’; -

--
Special operators for setting conditions:-

~BETWEEN ……AND
- IN
- LIKE
-IS
BETWEEN ……AND
A range of values can be given as condition.
-
SELECT name,f_income FROM student WHERE f_income BETWEEN 25000
AND 45000;
-
- ---

-
IN
A list of values can be provided as condition

SELECT * FROM student WHERE course IN (‘commerce’,’humanities’);


- -
or
SELECT * FROM student WHERE course NOT IN(‘science’);
--
LIKE
Condition based on Pattern Matching
→ String data having some similarities in characters is the condition for
accessing records.

→ Two wild card characters are used %(percentage) and _(underscore)


-
→ % denotes substring and _ denotes single character
Ab → ”Ab%” matches any string beginning with “Ab”.
-

→ ”%cat%”
--
matches any string containing “cat” as substring
eg:- “education”,”indication”,”catering”….etc.
- - -

→ ”----” matches any string of exactly four characters without any space in
between them.
-
-

→ ”---%” matches any string of at least 3 characters.



SELECT name FROM student WHERE name LIKE ‘%ar’;
↑ -

T
-


SELECT name FROM student WHERE name LIKE ‘Div__ar’;
-

as
-
Div-- -
-
IS
Condition based on null value search

SELECT name,course FROM student WHERE f_income IS NLL;


-- --

-
-
SELECT * from student;
--- - ~

T E S

F E
L

E
- ---
ORDER BY clause
Used for sorting Result in Alphabetic order.
-→ ASC keyword is used for Ascending order.
~
→ DESE
②keyword is used for descending order. ↓
best SELECT * FROM student ORDER BY name;
-----

-
-
-
Descending order sorting

C
SELECT * FROM student ORDER BY name DESE;
-- -
D
- -

&

-
Explain different types of Aggregate
Functions
Aggregate Functions

-
-

-
-
~
-
SELECT MAX(f_income), MIN(f_income),AVG(f_income) FROM
student; - - -
-

- - -

- -
-SELECT COUNT(*),COUNT(f_income) FROM student WHERE
-

course=‘Science’; -

& - =
GROUP BY clause
Used for grouping of records
→ Rows of a table can be grouped together based on a common value.
→ Tuples with the same attribute value are placed together in one group.
→ This process can be considered as categorization of records.

SELECT course,COUNT(*),AVG(f_income) from student GROUP BY course;


-
- -

-
-
- -

- -
HAVING clause
Used for Applying conditions to from groups Used along with
GROUP BY clause.

SELECT course, COUNT(*) FROM student GROUP BY course HAVING


COUNT(*)>3; ----
-

-
-
UPDATE Command
→Used for modifying table date.

→It is a DML command

→Values in one or more columns of specified rows can be changed.

→Changes may be affected in all or in selected rows of the table.

→The new data is given using


SET keyword (essential clause of UPDATE)
-

→The new data can be a constant, an expression or data from other tables.
The syntax of UPDATE command:-
-
UPDATE <table_name> SET <column_name> =
-
-

<value>[,<column_name>=<value>,……] WHERE <condition>;


- -

- -
Eg:- - -

UPDATE student SET f_income=27000 WHERE name=‘kaushi’;


-
-

SELECT * FROM student WHERE name=‘Kaushi’;


-

~ -

O
DELETE command
Syntax:
DELETE FROM <table_name> [WHERE <condition>];
-
-

Eg:-
DELETE FROM student2015 WHERE adm_no=2027;
- #

~
Thank belmon↑
you
a

You might also like