0% found this document useful (0 votes)
30 views27 pages

Department of Computer Technology MIT Campus:: Anna University

This document provides information about a course on Application Development Practices taught at the Department of Computer Technology at MIT Campus of Anna University. It lists the course instructor and teaching assistants. It provides the class timetable, date, module details including lecture, tutorial, practical and external learning activities. It suggests evaluation methods including a quiz. It then provides information about various topics that will be covered in the module including web servers, proxy servers, PHP and SQL.

Uploaded by

Bala
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)
30 views27 pages

Department of Computer Technology MIT Campus:: Anna University

This document provides information about a course on Application Development Practices taught at the Department of Computer Technology at MIT Campus of Anna University. It lists the course instructor and teaching assistants. It provides the class timetable, date, module details including lecture, tutorial, practical and external learning activities. It suggests evaluation methods including a quiz. It then provides information about various topics that will be covered in the module including web servers, proxy servers, PHP and SQL.

Uploaded by

Bala
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/ 27

Department of Computer Technology

MIT Campus :: Anna University


B.E. COMPUTER SCIENCE AND ENGINEERING RUSA
REGULATIONS – 2018

APPLICATION DEVELOPMENT PRACTICES

Course Instructor Dr. S.Neelavathy Pari

Teaching Assistants 1. Ms.J.Chandrapriya


2. Ms.S.Anitha
3. Ms.Jenila Vincent
4. Ms. Adhimuga sivasakthi
5. Ms.V.Brindha
6. Ms. R.Naga Priyadharshini

Time Table

Class Time Day Venue


2/8 BE CSE 2.50 PM ~ 4.30 PM Monday CB103
2/8 BE CSE 8.30 AM ~12.10 PM Wednesday HPC, DCL
LAB

Date :05-02-2020
MODULE 5 :

lecture Tutorial Practical External Learning


1 0 4 3

 Understanding servers – Server login, Database connectivity


 Sql query, PHP,

SUGGESTED ACTIVITIES : EL – Overview of databases

SUGGESTED EVALUATION METHODS:

 Quiz on servers and overview of databases

WEB SERVERS
Web server is a computer where the web content is stored. Basically web server is
used to host the web sites but there exists other web servers also such as gaming,
storage, FTP, email etc.

Web site is collection of web pages while web server is a


software that respond to the request for web resources.
Proxy Server
Proxy server is an intermediary server between client and the internet. Proxy servers offers the
following basic functionalities:

 Firewall and network data filtering.


 Network connection sharing
 Data caching

Proxy servers allow to hide, conceal and make your network id anonymous by hiding
your IP address
Purpose of Proxy Servers

Following are the reasons to use proxy servers:

 Monitoring and Filtering


 Improving performance
 Translation
 Accessing services anonymously
 Security

Monitoring and Filtering

Proxy servers allow us to do several kind of filtering such as:

 Content Filtering
 Filtering encrypted data
 Bypass filters
 Logging and eavesdropping

Improving performance

It fasten the service by process of retrieving content from the cache which was saved when
previous request was made by the client.

Translation

It helps to customize the source site for local users by excluding source content or substituting
source content with original local content. In this the traffic from the global users is routed to the
source website through Translation proxy.

Accessing services anonymously

In this the destination server receives the request from the anonymzing proxy server and thus
does not receive information about the end user.

Security

Since the proxy server hides the identity of the user hence it protects from spam and the hacker
attacks.
Type of Proxies
Proxy user interface

This module controls and manages the user interface and provides an easy to use graphical
interface, window and a menu to the end user. This menu offers the following functionalities:

 Start proxy
 Stop proxy
 Exit
 Blocking URL
 Blocking client
 Manage log
 Manage cache
 Modify configuration
Proxy server listener

It is the port where new request from the client browser is listened. This module also performs
blocking of clients from the list given by the user.

Connection Manager

It contains the main functionality of the proxy server. It performs the following functions:

 It contains the main functionality of the proxy server. It performs the following functions:
 Read request from header of the client.
 Parse the URL and determine whether the URL is blocked or not.
 Generate connection to the web server.
 Read the reply from the web server.
 If no copy of page is found in the cache then download the page from web server else
will check its last modified date from the reply header and accordingly will read from the
cache or server from the web.
 Then it will also check whether caching is allowed or not and accordingly will cache the
page.

Cache Manager

This module is responsible for storing, deleting, clearing and searching of web pages in the
cache.

Log Manager

This module is responsible for viewing, clearing and updating the logs.

Configuration

This module helps to create configuration settings which in turn let other modules to perform
desired configurations such as caching.

PHP
PHP is acronym of Hype rtext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases.PHP is basically used for
developing web based software applications.

PHP started out as a small open source project that evolved as more and more people found out
how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.
Key Points

 PHP is a recursive acronym for "PHP: Hypertext Preprocessor".


 PHP is a server side scripting language that is embedded in HTML. It is used to manage
dynamic content, databases, session tracking, even build entire e-commerce sites.
 It is integrated with a number of popular databases, including MySQL, PostgreSQL,
Oracle, Sybase, Informix, and Microsoft SQL Server.
 PHP is pleasingly zippy in its execution, especially when compiled as an Apache module
on the Unix side. The MySQL server, once started, executes even very complex queries
with huge result sets in record-setting time.
 PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4
added support for Java and distributed object architectures (COM and CORBA), making
n-tier development a possibility for the first time.

Uses of PHP

PHP has now become a popular scripting language among web developer due to the following
reasons −

 PHP performs system functions, i.e. from files on a system it can create, open, read,
write, and close them.
 PHP can handle forms, i.e. gather data from files, save data to a file, through email you
can send data, return data to the user.
 You add, delete, modify elements within your database through PHP.
 Access cookies variables and set cookies.
 Using PHP, you can restrict users to access some pages of your website.
 It can encrypt data.

Characteristics

Five important characteristics make PHP's practical nature possible −

 Simplicity
 Efficiency
 Security
 Flexibility
 Familiarity

"Hello World" Script in PHP

To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an essential
example, first we will create a friendly little "Hello, World!" script.

As mentioned earlier, PHP is embedded in HTML. That means that in amongst your normal
HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this −

<html>

<head>
<title>Hello World</title>
</head>

<body>
<?php echo "Hello, World!";?>
</body>

</html>

If you examine the HTML output of the above example, you'll notice that the PHP code is not
present in the file sent from the server to your Web browser.

All of the PHP present in the Web page is processed and stripped from the page; the only thing
returned to the client from the Web server is pure HTML output.

All PHP code must be included inside one of the three special markup tags ate are recognized by
the PHP Parser.

<?php PHP code goes here ?>


<? PHP code goes here ?>
<script language="php"> PHP code goes here </script>
Structured Query Language (SQL)
SQL is a standard language for storing, manipulating and retrieving data in
databases.

 MySQL
 SQL Server
 MS Access
 Oracle
 Sybase
 Informix
 Postgres

SQL ARchitecture
What is table?The table is a collection of related data entries and it consists of columns and
rows a table is the most common and simplest form of data storage in a relational database.
What is field?
Every table is broken up into smaller entities called fields. The fields in the
CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.A field is a
column in a table that is designed to maintain specific information about every record in
the table.

What is record or row?


A record, also called a row of data, is each individual entry that exists in a table. For
example, there are 7 records in the above CUSTOMERS table. Following is a single
row of data or record in the CUSTOMERS table

1 RAMESH 32 Ahmedabad 32

What is column?
A column is a vertical entity in a table that contains all information associated with a
specific field in a table. For example, a column in the CUSTOMERS table is ADDRESS,
which represents location description and would consist of the followi ng

Name

Ahmedabad

Delhi

Kota

Mumbai

Bhopal

MP

Indore

What is NULL value?


A NULL value in a t able is a value in a field that appears to be blank,which means afield with a NULL
value is a field with no value. It is very important to understand that a NULL value is different than a zero
value or a field that cont ains spaces. A field with a NULL value is one that has been left blank during
record creation.
SQL Constraints:
Constraints are the rules enforced on data columns on table. These are used to limit the
type of data that can go into a table. This ensures the accuracy and reliability of the data
in the database.Constraints could be column level or table level. Column level
constraints are applied only to one column,whereas table level constraints are applied
to the whole table

Following are commonly used constraints available in SQL

 NOT NULL Constraint: Ensures that a column cannot have NULL value .

 DEFAULT Constraint: Provides a default value for a column when none is


specified.

 UNIQUE Constraint: Ensures that all values in a column are different.

 PRIMARY Key: Uniquely identified each rows/records in a database table .

 FOREIGN Key: Uniquely identified a rows/records in any another database table .

 CHECK Constraint: The CHECK constraint ensures that all values in a column
satisfy certain conditions

 INDEX: Use to create and retrieve data from the database very quickly.
PRIMARY Key:
A primary key is a field in a table which uniquely identifies each row/record a database
table.

Primary keys must contain unique values.

A primary key column cannot have NULL values.

A table can have only one primary key,which may consist of single or multiple fields.
When multiple fields are used as a primary key, they are called a composite key.

If a table has a primary key defined on any field(s),then you can not have two records
having the same value of that field(s).
If you use the ALTER TABLE statement to add a pr imary key, the primary key column(s) must already have been dec lared
to not contain NULL values (w hen the table w as first created).For defining a PRIMA RY KEY constraint on multiple columns,
use the follow ing SQL syntax
Introduction to DDL
 DDL stands for Data Definition Language.
 It is a language used for defining and modifying the data and its structure.
 It is used to build and modify the structure of your tables and other objects in the database.

DDL commands are as follows,


1. CREATE
2. DROP
3. ALTER
4. RENAME
5. TRUNCATE

 These commands can be used to add, remove or modify tables within a database.
 DDL has pre-defined syntax for describing the data.

1. CREATE COMMAND

 CREATE command is used for creating objects in the database.


 It creates a new table.

Syntax:
CREATE TABLE <table_name>
( column_name1 datatype,
column_name2 datatype,
.
.
.
column_name_n datatype
);

Example : CREATE command

CREATE TABLE employee


(
empid INT,
ename CHAR,
age INT,
city CHAR(25),
phone_no VARCHAR(20)
);

------------------------------------------------------------------------------------------------------------

2. DROP COMMAND

 DROP command allows to remove entire database objects from the database.
 It removes entire data structure from the database.
 It deletes a table, index or view.

Syntax:
DROP TABLE <table_name>;
OR
DROP DATABASE <database_name>;

Example : DROP Command

DROP TABLE employee;


OR
DROP DATABASE employees;

If you want to remove individual records, then use DELETE command of the DML statement.

--------------------------------------------------------------------------------------------------------------------------------

3. ALTER COMMAND

 An ALTER command allows to alter or modify the structure of the database.


 It modifies an existing database object.
 Using this command, you can add additional column, drop existing column and even change the
data type of columns.

Syntax:
ALTER TABLE <table_name>
ADD <column_name datatype>;

OR

ALTER TABLE <table_name>


CHANGE <old_column_name> <new_column_name>;

OR
ALTER TABLE <table_name>
DROP COLUMN <column_name>;

Example : ALTER Command

ALTER TABLE employee


ADD (address varchar2(50));

OR

ALTER TABLE employee


CHANGE (phone_no) (contact_no);

OR

ALTER TABLE employee


DROP COLUMN age;

----------------------------------------------------------------------------------------------------------

4. RENAME COMMAND

 RENAME command is used to rename an object.


 It renames a database table.

Syntax:
RENAME TABLE <old_name> TO <new_name>;

Example:
RENAME TABLE emp TO employee;
----------------------------------------------------------------------------------------------------------------------------

5. TRUNCATE COMMAND

 TRUNCATE command is used to delete all the rows from the table permanently.
 It removes all the records from a table, including all spaces allocated for the records.
 This command is same as DELETE command, but TRUNCATE command does not generate any
rollback data.

Syntax:
TRUNCATE TABLE <table_name>;

Example:
TRUNCATE TABLE employee;

-----------------------------------------------------------------------------------------------------------------------------------
Introduction to DML

 DML stands for Data Manipulation Language.


 It is a language used for selecting, inserting, deleting and updating data in a database.
 It is used to retrieve and manipulate data in a relational database.

DDL commands are as follows,


1. SELECT
2. INSERT
3. UPDATE
4. DELETE

 DML performs read-only queries of data.

1. SELECT COMMAND

 SELECT command is used to retrieve data from the database.


 This command allows database users to retrieve the specific information they desire from an
operational database.
 It returns a result set of records from one or more tables.

SELECT Command has many optional clauses are as stated below:

Clause Description
WHERE It specifies which rows to retrieve.
GROUP BY It is used to arrange the data into groups.
HAVING It selects among the groups defined by the GROUP BY clause.
ORDER BY It specifies an order in which to return the rows.
AS It provides an alias which can be used to temporarily rename tables or columns.
Syntax:
SELECT * FROM <table_name>;

Example : SELECT Command

SELECT * FROM employee;

OR

SELECT * FROM employee


where salary >=10,000;

2. INSERT COMMAND

 INSERT command is used for inserting a data into a table.


 Using this command, you can add one or more records to any single table in a database.
 It is also used to add records to an existing code.
Syntax:
INSERT INTO <table_name> (`column_name1` <datatype>, `column_name2` <datatype>, . . . ,
`column_name_n` <database>) VALUES (`value1`, `value2`, . . . , `value n`);

Example:
INSERT INTO employee (`eid` int, `ename` varchar(20), `city` varchar(20))
VALUES (`1`, `ABC`, `PUNE`);

3. UPDATE COMMAND

 UPDATE command is used to modify the records present in existing table.


 This command updates existing data within a table.
 It changes the data of one or more records in a table.

Syntax:
UPDATE <table_name>
SET <column_name = value>
WHERE condition;

Example : UPDATE Command

UPDATE employee
SET salary=20000
WHERE ename='ABC';

4. DELETE COMMAND

 DELETE command is used to delete some or all records from the existing table.
 It deletes all the records from a table.

Syntax:
DELETE FROM <table_name> WHERE <condition>;

Example : DELETE Command

DELETE FROM employee


WHERE emp_id = '001';

If we does not write the WHERE condition, then all rows will get deleted.
Introduction to DCL

 DCL stands for Data Control Language.


 DCL is used to control user access in a database.
 This command is related to the security issues.
 Using DCL command, it allows or restricts the user from accessing data in database schema.

DCL commands are as follows,


1. GRANT
2. REVOKE

 It is used to grant or revoke access permissions from any database user.

1. GRANT COMMAND

 GRANT command gives user's access privileges to the database.


 This command allows specified users to perform specific tasks.

Syntax:
GRANT <privilege list>
ON <relation name or view name>
TO <user/role list>;

Example : GRANT Command

GRANT ALL ON employee


TO ABC;
[WITH GRANT OPTION]

In the above example, user 'ABC' has been given permission to view and modify the records in the
'employee' table.

2. REVOKE COMMAND

 REVOKE command is used to cancel previously granted or denied permissions.


 This command withdraw access privileges given with the GRANT command.
 It takes back permissions from user.

Syntax:
REVOKE <privilege list>
ON <relation name or view name>
FROM <user name>;
Example : REVOKE Command

REVOKE UPDATE
ON employee
FROM ABC;

Difference between GRANT and REVOKE command.


GRANT REVOKE

GRANT command allows a user to perform certain REVOKE command disallows a user to perform
activities on the database. certain activities.

It grants access privileges for database objects to It revokes access privileges for database objects
other users. previously granted to other users.

Example:
Example:
GRANT privilege_name
ON object_name REVOKE privilege_name
TO ON object_name

{ FROM
user_name|PUBLIC|role_name {
} user_name|PUBLIC|role_name
}
[WITH GRANT OPTION];

Exercise

1. Install XAMMP and learn XAMPP control Panel.

2. Create a PHP test page, store them on your XAMPP’s local host, and retrieve them via the web
browser.

i. Open the XAMPP directory through the ‘Explorer’ button in the Control Panel and
choose the folder htdocs (C:\xampp\htdocs for standard installations). This directory
will store file data collected for web pages that you test on your XAMPP server. The
htdocs folder should already contain data to help configuration of the web server. But
you should store your own projects in a new folder (like ‘Test Folder’ for example).
ii. You can create a new PHP page easily by using the following content in your editor and
storing it as test.php in your ‘ test’ folder (C:\xampp\htdocs\test):

iii. The last step now is to open your web browser and load your PHP page via
localhost/test/test.php. If your browser window displays the words ‘Hello World’,
then you’ve successfully installed and configured your XAMPP.

3. create a table named customer with the following felids

Custome rID Custome rName ContactName Address City PostalCode Country

4. Create a table of genres for books using CREATE TABLE, then insert a few rows using INSERT INTO.
5. Practice the following sql commands for the table customer (Exercise 3).

write the syntax of the following statement in the observation note book and explain
with example.

 SELECT - extracts data from a database

 UPDATE - updates data in a database


 DELETE - deletes data from a database
 INSERT INTO - inserts new data into a database
 CREATE DATABASE - creates a new database
 ALTER DATABASE - modifies a database
 ALTER TABLE - modifies a table
 DROP TABLE - deletes a table

6.

You might also like