CHR 5,6,7,8,9
CHR 5,6,7,8,9
USING HTML
? Write HTMLtag for the following
~
(a) Hyperlink to the website http://www.dhsekerala.gov.in
-
--
-
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
-
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>
--
<li>item2</li> -
……………………
…………………… S
<li>item n</li>
--
</ol>
→Type and Start attribute.
Type attribute, which can set with the values as detailed below:
-
-
-
- -
-
-
-
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).
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.
-
-
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
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:-
-→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.
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.
-
---
- -
-
-
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
- → The program used in the web page may require windows hosting or Linux
hosting.
-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. ---
-
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 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.
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.
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.
--
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.
-
Yn j
To select all the students who are eligible for higher studies.
𝜎Result="EHS" ( STUDENT)
-
-
-
-
-
-
-
PROJECT operation
-
𝝅𝑨𝟏,𝑨𝟐,…, 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.
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
-
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
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)
- -
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 -
Command Description
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
I
-
-
( 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. --
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.
--
----
DROP command
“Removing table from a database”
Using the command DROP TABLE command.
---
- - - -
- -
↑
-
- ~
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);
--
-
44
-
-
1
↑
SELECT command
“Retrieving information from tables”
Simplest form of SELECT command:-
&
-
- -
-
-
-
- -
-
-
↑ -
-
M
-
SELECT * FROM student;
WHERE clause
Syntax:-
-
-
-
---
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
→ ”%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.
-
-
T
-
↑
SELECT name FROM student WHERE name LIKE ‘Div__ar’;
-
as
-
Div-- -
-
IS
Condition based on null value search
-
-
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.
-
-
- -
- -
HAVING clause
Used for Applying conditions to from groups Used along with
GROUP BY clause.
-
-
UPDATE Command
→Used for modifying table date.
→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> =
-
-
- -
Eg:- - -
~ -
O
DELETE command
Syntax:
DELETE FROM <table_name> [WHERE <condition>];
-
-
Eg:-
DELETE FROM student2015 WHERE adm_no=2027;
- #
~
Thank belmon↑
you
a