Grade 12 It Chapter 3 &4
Grade 12 It Chapter 3 &4
The term Relational Database Management System (RDBMS) usually refers to various types of
software systems developed in order to manage databases. RDBMS is used to create, maintain, and
provide controlled access to a relational database.
A relational database is based on a relational data model. Data are stored in a two-dimensional table,
which contains columns or fields and rows or records.
Each column of a table represents an attribute or data value, and each row in a table represents a tuple or
record.
A database contains one or more tables that maintain records.
Attributes are the set of properties to describe the instances of the entity. For example, a student can be an
entity. The attributes of a student can be described in terms of student id, name, age, grade level and sex.
below has five attributes (or pieces of data). A record is a row or a tuple in the table. It contains a single
data value in each column.
Each field in a table has to be given a name and data type. A data type is the type of data value you want
to store in the field. For example, to populate this database you would use residence id to populate the
By ya.m 1 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
residence id field. Here, we know that a residence id is mentioned as a four-digit number. The second
field, first name, is used to store the first name. Name is an attribute stated in text form
In the database, the data type best describes the fields in the table. For example, referring to Table 3.2,
age can be input by an integer data type, price by float or real number,
All Database Management System(DBMS) provide data types from which to select and use to define the
data type for fields of a table. For example, in MS Access, when you create a new database table, data
types include text, integer, real numbers, dates, currency and yes or no fields five tables: Students,
MarkList, Subject, Subject Assigned and Teachers.
SQL is a special purpose query language meant for interacting with relational databases. Understanding
how SQL works can help you create better queries, and make it easier for you to understand how to fix a
query that is not returning the results that you want. SQL is a language for interacting with databases. It
consists of a number of commands with further options to allow you to carry out your operations with a
database. All RDBMS commands are written using the SQL statements.
Based on their purposes, three categories of Three Categories of SQL Commands:.
Data Definition Language (DDL): commands define the structure of the database, such as creating,
altering, or deleting tables. CREATE: Creates a new database object (e.g., table).
By ya.m 2 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
By ya.m 3 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
1. One-to-One Relationship: One record in a table is related to only one record in another table.
Example: A person has one passport.
2. One-to-Many Relationship: One record in a table is related to many records in another table.
Example: One customer can place many orders, but each order is associated with one customer.
3. Many-to-Many Relationship: Many records in one table can be associated with many records in
another table.
Example: Students can enroll in many courses, and courses can have many students. This usually requires
a junction table.
You can write SQL directly in Access for DML, DDL, and DQL operations.
a) DDL Command Examples (Create Tables)
To define the structure, you can use SQL View in Access. Here's how to create a table:
CREATE TABLE Students (
StudentID AUTONUMBER PRIMARY KEY,
FirstName TEXT(50),
LastName TEXT(50),
DateOfBirth DATE,
Gender TEXT(10)
);
b) DML Command Examples (Manipulate Data)
By ya.m 4 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
The extensible Markup Language (XML) is a markup language like HTML. A markup language is a
computer language that uses tags enclosed with less than (<) and greater than (>) symbols to define
elements within a document. When the file
is processed by a suitable application, the tags are used to control the structure or presentation of the data
contained in the file. Any text that appears within one of these tags is considered part of the markup
language. Markup files contain standard words, rather than typical programming syntax.
4.1.1 Elements of XML Documents
XML document must contain one root element that is the parent of all other elements, for example
“<people>” The best way to learn what makes up an XML document is by starting from a simple
example. The following is a complete XML document that lists the names of two known athletes.
XML declaration: describes the general characteristics of the document,such as XML document, the
version of the XML, and the encoding character it uses. XML documents usually begin with the XML
declaration statement called the processing instructions which provide information on how the XML file
should be processed. E.g. <?XML version= “1.0” encoding=“UTF-8”?> The processing instruction
statement uses the encoding property to specify the encoding scheme used to create the XML file.
Encoding is the process of converting Unicode character into their binary equivalent representation
depending on the type of encoding(‘UTF-8’ or ‘UTF-16’).
Document Type Declaration (DTD): describes the structure of the documentin terms of which elements
it may contain, along with any restrictions it may have. In other words, it describes the root. The above
example is about people.
The document ‘people’ is described with five elements. These are described below.
XML does not change the way your web pages looks; instead, it changes the way the documents are read
and filed and stored. Therefore, XML is used to describe the structure of a document rather than the way
it is presented.
The two areas in which XML is useful are structuring data for storage, where a relational database (See
Unit Three about database) is inappropriate, and the presentation of web pages. For example, a system is
handling small quantities of data, or if the data lacks a relational structure, programmers usually prefer to
create their own data formats, i.e. XXML declaration: describes the general characteristics of the
document, such as XML document, the version of the XML, and the encoding character it uses. XML
documents usually begin with the XML declaration statement called the processing instructions which
provide information on how the XML file should be processed. E.g. <?XML version= “1.0”
encoding=“UTF-8”?> The processing instruction statement uses the encoding property to specify the
encoding scheme used to create the XML file. Encoding is the process of converting Unicode character
into their binary equivalent representation depending on the type of encoding(‘UTF-8’ or ‘UTF-16’).
Document Type Declaration (DTD): describes the structure of the document in terms of which elements
it may contain, along with any restrictions it may have. In other words, it describes the root. The above
example is about people.Document Type Declaration (DTD): describes the structure of the document in
terms of which elements it may contain, along with any restrictions it may have. In other words, it
describes the root. The above example is about people.
XML declaration: describes the general characteristics of the document, such as XML document, the
version of the XML, and the encoding character it uses. XML documents usually begin with the XML
declaration statement called the processing instructions which provide information on how the XML file
should be processed. E.g. <?XML version= “1.0” encoding=“UTF-8”?> The processing instruction
statement uses the encoding property to specify the encoding scheme used to create the XML file.
By ya.m 5 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
Encoding is the process of converting Unicode character into their binary equivalent representation
depending on the type of encoding(‘UTF-8’ or ‘UTF-16’).
Internal DTD subset: a DTD is internal if the elements are declared within the same XML file. In the
following example, internal declarations that are local to the XML document are used.
„ XML information set or Content: this represents the XML document’s content—the information that
the document conveys. Content refers to the information that is represented by the elements
Root element: This encloses all of the information. An XML document can have only one root element.
Therefore, “<people>” is the root of this XML document.
Start tag: XML elements have a start and an end tag—the start tag provides the name of the XML
element. End tag: The name of the end tag must exactly match the name of the start tag.
E.g. <people> with </people>, <person> with </person>, <first> with </first>
XML element: The start and the end tags are collectively referred to as an XML elements. Elements are
the basic units that are used to identify and describe the data in XML. They are the building blocks of an
XML document. E.g. <last>Kebede</last>
Data: XML elements can contain data between the start and the end tags. An XML document represents
information using a hierarchy. That means, it begins with a root element (e.g. people), which contains
sub-elements (e.g. person) which in turn can contain other sub-elements(e.g. name), data (e.g. Kebede), or
both. E.g. Abebech, Kebede, Jemal, and Ahmed are data.
Attribute: Like HTML, XML elements can contain attributes. An attribute provides additional
information about the elements for which it is declared. It consists of a name-value pair. In the following
example, the attribute name is personid and the value is “101”. The attribute value should be quoted:
single or double quotes can be used.
E.g. <name personid = “101”>Ubang </name>
Comment: This is a kind of note or statement that is used to describe the XML code. Comments can
provide documentation information about the XML file or the application to which the file belongs. A
comment is ignored by the XML parser(or a program that interpretes XML instruction) during code
execution. The syntax for a comment is: <!-- This is a comment -->
We can see the whole hierarchy of the above markup in an upside-down tree struc-ture
Although XML is designed so that people can read it, it is not intended to create a finished document. In
other words, you can not open up just any XML-tagged document in a browser and expect it to be
formatted well. XML is meant to hold content so that when the document is combined with other
resources, such as a style sheet which renders a web page, it becomes a finished product.
By ya.m 6 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
4.1.2 Creating XML Documents There are a few ways of opening an XML file directly. You can open
and edit XML files with any text editor, view them with any web browser, or use a website that lets you
view, edit, and even convert them to other formats. You can also
use applications such as “oxygen” or “XML Notepad” to see your files’ structures. In this section, we use
“XML Notepad” for our demonstration. For example, after saving the XML code given above as an
example with the *.xml extension in any text editor,
Syntax rules to be remembered while working on XML:
1. You should have one root: XML documents must contain one element that is the parent of all
other elements.
2. XML elements are case sensitive
3. All elements should not overlap, and they must properly be nested within each other.
4. XML attribute values must always be quoted. The XML elements can have attributes in name-
value pairs which are similar to HTML.
5. Comments in XML: The syntax for writing comments in XML is similar to that of HTML
6. XML does not truncate multiple white-spaces. In HTML, multiple white-spaces are truncated to a
single white-space
Entity References: In XML, some characters have special meaning. For example, a character like “<”
inside an XML element will generate an error. This is because the XML parser interprets “<” as the start
of a new XML
Element Declarations: XML documents consist of three things: elements, entities, and control
information. Elements are surrounded by tags like HTML. The content of the document has a structure
imposed by the rules of XML although this structure is quite loose. Each document has a single root
element that contains all of the other markups. You have already learned this point in HTML where all
documents are enclosed inside <html></html> tags. The document is then composed of several sections,
each of which is enclosed between tags. The sections themselves are also elements.
An XML element is everything from the start tag to the end tag’s of the element. An element without
content is said to be empty element. An empty element can be described in one of the following options.
Naming rules of XML elements:
Element names are case-sensitive.
Element names must start with a letter or underscore.
Element names cannot start with the letters XML.
By ya.m 7 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
Element names can contain letters, digits, hyphens, underscores, and periods.
Element names cannot contain spaces.
Attribute Declarations: An XML element, like HTML, can have attributes. The element’s attributes
define data related to a specific element. Attributes provide additional information about the element. An
attribute is defined as key-value pair: the key is the name (e.g. gender) and the attribute has values that
must always be quoted (e.g. “female”). Either single quotation marks (‘ ’) or double quotation marks (“
”) can be used. For example, a person element’s gender can be written like this:
If the value of the attribute itself contains double quotation marks, use single quotation marks, as shown
in this example <person gender= “female”>or <person gender= ‘male’>
Any name can be used, but no words are reserved (except XML
Elements vs. Attributes XML Elements vs. Attributes
In the first example gender is an attribute. In the next example, gender is an element. Both examples
provide the same information. There are no rules about when to use attributes or elements in XML.
Entity Declarations: An entity is a declaration of a name that can be used in an XML in place of content
or markup. Entities must be declared before they are used. All entities are declared with the “ENTITY”
declaration. However, the exact format of the declaration distinguishes between internal, external, and
parameter
There are two parts to entities. The first is an entity declaration of a name that tie the replacement content.
The above example declares an entity of the name ‘publisher’. The name ‘publisher’ is associated with
the content of “Berhanena Selam Printing”. The second is using the name defined in the entity declaration
subsequently in the XML as shown below. When the entity name is used in XML, it is called an entity
reference.
<author>Addis Alemayehu</author><pubinfo>Published by &publisher;</pubinfo>
When the parser subsequently encounters an ampersand symbol (i.e. &) and semicolon (i.e. ;) which
identify a general entity reference, the parser looks up that name in an entity declaration table (See Figure
4.9). In our case, the reference, &publisher; is replaced by the content that it represents. Using the
following (left column) XML, expanding the entity reference, and replacing the &publisher; with the
“Berhanena Selam Printing” content gives the following expanded XML.
Document Type Definition (DTD) it is defines the structure attributes of a document and the legal
elements of an XML document. It can be used by an application to verify that XML data is valid. A DTD
declared inside the XML file must be wrapped inside the definition.
<?xml version=”1.0”?> <!ELEMENT album (singer, name, release,
<!DOCTYPE album [ language)>
<!ELEMENT singer (#PCDATA)>
By ya.m 8 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
By ya.m 9 | P a g e
BY YARED GRADE 12 IT CHAPTER 3 &4 SHORT NOTE
3. Pages folder: this subfolder contains web pages of the site. For example: about, contact us, etc. The
name could be anything related to the site.
4. Images folder: this is the subfolder that contains all the images that are used on the site.
5. CSS folder: CSS code used to style the site resides in this folder. It includes, for example setting text
and background colors.
6. scripts folder: this subfolder contains all the JavaScript code used to add interactive functionality to
the site (e.g. buttons that load data when clicked).
A website is published by uploading website content or files onto the remote server which is provided by
the hosting company or web host. Hosting companies provide web hosting services, which means
providing online space for the storage of websites. A website is made available via World Wide Web
(WWW). Web hosts must possess a web server. The web server is the actual location where your website
resides. A web server may host single or multiple sites depending on what hosting service you have paid
for. The process of publishing a website also involves registering a domain name. A domain name is the
part of your internet address that comes after “www”. For example, in http://www.moe.gov.et/, the
domain name is moe.gov. A domain name becomes your online business address, so care should be taken
when selecting a domain name. Your domain name should be easy to remember and easy to type. It must
be unique. If the one you want to use is taken or not available, domain registration fails, and you need to
find another one. A domain extension is made up of three letter (for example, .gov in the above URL) at
the end of the internet address which is known as a top-level domain names. The most common domain
extensions include:
.com for commercial sites. • .org for a non-profit organization.
• .edu for educational institution. • .mil for military.
• .gov for government institutions.
• .net for network
Security options To keep your site safe and secure, a secure URL is needed. Particularly, if the site
visitors are providing their private information, HTTPS is required, not HTTP. HTTPS (Hypertext
Transfer Protocol Secure) is a protocol that is used to provide security over the Internet. To enable
HTTPS, your website needs an SSL. SSL stands for Secure Sockets Layer which provides a secure online
connection, and your website needs an SSL Certificate. SSL is also another necessary site protocol. It
ensures your site visitor’s personal information transfers between the website and your database is secure.
SSL encrypts information (send from you/receive from the server) to prevent others from accessing and
reading it while in transit
Assignment
Part 1 explain the following question
1. What is XML?
2. What is HTML?
3. What are the advantages and disadvantages of using XML?
4. What is the difference between HTML and XML in terms of tag usage?
5. How is XML different from HTML in terms of data handling?
6. What is the role of attributes in XML?
By ya.m 10 | P a g e