OST Lab Manual
OST Lab Manual
OST Lab Manual
8. Write the query to perform the Create & Insert operation in MySQL.
9. Write the query to perform the Update & Delete operation in MySQL.
11. Write the query to perform the Sorting (Order By & Group By) in MySQL.
13. Write the query to perform the DATE & TIME Operation in MySQL.
17. Write a program to find the greater number among the three numbers in
python.
18. Write a program for print the table of given number in python.
19. Write a program for factorial of given number in python.
20. Write a program for Fibonacci series in python.
21. Write a program for File Handling in python.
Practical- 2
Object- Explain Open Source Software and List 10 names of OSS. Explain need of
opensource technology.
➢ What is PHP-
PHP is an open-source, interpreted, and object-oriented scripting language that can be executed at the
server-side. PHP is well suited for web development. Therefore, it is used to develop web applications (an
application that executes on the server and generates the dynamic page.).
PHP was created by Rasmus Lerdorf in 1994 but appeared in the market in 1995. PHP 7.4.0 is the latest
version of PHP, which was released on 28 November. Some important points need to be noticed about
PHP are as followed:
• PHP stands for Hypertext Pre-processor.
• PHP is an interpreted language, i.e., there is no need for compilation.
• PHP can be embedded into HTML.
• PHP is an object-oriented language.
• PHP is simple and easy to learn language.
➢ PHP Variables-
• In PHP, a variable is declared using a $ sign followed by the variable name.
• As PHP is a loosely typed language, so we do not need to declare the data types of the variables
automatically analyse the values and makes conversions to its correct datatype.
• After declaring a variable, it can be reused throughout the code.
• Assignment Operator (=) is used to assign the value to a variable.
Example-
$variablename=value;
<?php
$str="hello string";
$x=200;
$y=44.6;
echo "string is: $str <br/>";
echo "integer is: $x <br/>";
echo "float is: $y <br/>";
?>
Output:
➢ PHP Data Types-
PHP data types are used to hold different types of data or values.
• PHP Boolean- Booleans are the simplest data type works like switch. It holds only two values: TRUE
(1) or FALSE (0). It is often used with conditional statements. If the condition is correct, it returns
TRUEotherwise FALSE.
• PHP Integer-Integer means numeric data with a negative or positive sign. It holds only whole numbers,
i.e., numbers without fractional part or decimal points.
• PHP Float- A floating-point number is a number with a decimal point. Unlike integer, it can hold numbers
with a fractional or decimal point, including a negative or positive sign.
• PHP String- A string is a non-numeric data type. It holds letters or any alphabets, numbers, and even
special characters. String values must be enclosed either within single quotes or in double quotes. But
both are treated differently.
• PHP Array-An array is a compound data type. It can store multiple values of same data type in a single
variable.
• PHP object- Objects are the instances of user-defined classes that can store both values and functions.
They must be explicitly declared.
• PHP Null- Null is a special data type that has only one value: NULL. There is a convention of writing it
in capital letters as it is case sensitive.
Practical-3
Code-
<html>
<head >
<title>registration</title>
</head>
<body bgcolor="sky blue">
<div>
<?php
if(isset($_POST['create']))
{
echo 'submitted';
}
?>
</div>
<div>
<form action "REGISTRATION.php" method="post">
<div class="container">
<center><h3>STUDENT REGISTRATION FORM</h3></center>
<label1 for="NAME"><b><h5>NAME</h5></b></label1>
<input type="text" name="NAME" required>
<label1 for="EMAIL"><b><h5>EMAIL</h5></b></label1>
<input type="EMAIL" name="EMAIL" required>
<label1 for="PASSWORD"><b><h5>PASSWORD</h5></b></label1>
<input type="PASSWORD" name="PASSWORD" required>
<input type="SUBMIT" name="SUBMIT">
</div>
</form>
</div>
</body>
</html>
Output-
Practical-4
Object- write a program to perform string operation in php.
Code-
<?php
$str="hello php";
$x=233;
$y=67.6;
echo "string is: $str <br/>";
echo "integer is: $x <br/>";
echo "float is: $y <br/>";
?>
Output-
Practical-5
Object- write a program to perform date time operation in php.
Code-
<?php
echo "Today's date in various formats:" . "\n";
echo date("d/m/Y") . "\n";
echo date("d-m-Y") . "\n";
echo date("d.m.Y") . "\n";
echo date("d.M.Y/D");
?>
Output-
Practical-6
Object- Write the steps to establish connection with XAMPP for MySQL.
Steps-
Step 1- firstly open XAMPP control panel and click on MYSQL start.
MySQL
Data
String Numeric
Date &
Time
1. String Types:-
Although the numeric and date types are fun, most data you'll store will be in a string format. This list describes
the common string datatypes in MySQL.
• Char(M) − A fixed-length string between 1 and 255 characters in length (for example CHAR(5)), right-padded
with spaces to the specified length when stored. Defining a length is not required, but the default is 1.
• Varchar(M) − A variable-length string between 1 and 255 characters in length. For example,
VARCHAR(25). You must define a length when creating a VARCHAR field.
• Blob Or Text − A field with a maximum length of 65535 characters. BLOBs are "Binary Large Objects" and
are used to store large amounts of binary data, such as images or other types of files. Fields defined as TEXT
also hold large amounts of data. The difference between the two is that the sorts and comparisons on the stored
data are case sensitive on BLOBs and are not case sensitive in TEXT fields. You do not
• Longblob Or Longtext − A BLOB or TEXT column with a maximum length of 4294967295 characters. You
do
not specify a length with LONGBLOB or LONGTEXT.
• Enum − An enumeration, which is a fancy term for list. When defining an ENUM, you are creating a list of
items from which the value must be selected (or it can be NULL). For example, if you wanted your field to
contain "A" or "B" or "C", you would define your ENUM as ENUM ('A', 'B', 'C') and only those values (or
NULL)could ever populate that field.
Insert Operation-
insert into information value(1,"neha","O.S.T."),
(2,"sakshi","O.S.T."),
(3,"rekha","O.S.T."),
(4,"renu","O.S.T.");
select*from information;
Output-
Practical-9
Object- Write the query to perform the Update & Delete operation in MySQL.
Update Operation-
update information set subject="OPEN SOURCE"
where(name="rekha");select*from information;
Output-
Delete Operation-
Delete from information where sno="4";
select*from information;
Output-
Practical-10
Object- Write the query to perform the Selection operation in MySQL.
Select name from information;
Output-
Group By-
select* from emp_info group by emp_name;
output-
Practical-12
Object- Write the query to perform Aggregate functions in MySQL.
Sum()-
select sum(salary) "total_salary"from emp_info;
Avg()-
select avg(salary) "average_salary"from emp_info;
Max()-
select Max(salary) "max_salary"from emp_info;
Min()-
select Min(salary) "min_salary"from emp_info;
Count()-
select count(salary) "count of salary"from emp_info;
Practical-13
Object-Write the query to perform the DATE & TIME Operation in MySQL.
select CURRENT_TIMESTAMP AS "CURRENTTIMESTAMP";
Output-
Practical-14
Object-Write a program for add/remove element in tuple in python.
Add element-
Program-
thistuple = ("apple", "banana", "cherry")
y = list(thistuple)
y.append("orange")
thistuple = tuple(y)
print(thistuple)
output-
Remove element-
Program-
thistuple = ("apple", "banana", "cherry")
y = list(thistuple)
y.remove("apple")
thistuple = tuple(y)
print(thistuple)
output-
Practical-15
Object- Write a program for add/remove elements in list in python.
Program-
Add element-
thislist = ["apple", "banana", "cherry"]
thislist.append("orange")
print(thislist)
Output-
Program-
Remove element-
thislist = ["apple", "banana", "cherry"]
thislist.remove("banana")
print(thislist)
Practical-16
Object- Write a program for if-else conditional statement in Python.
Program-
a=2
b=4
if(a<b)
:
print("a is less then b")
else:
print("b is the less then a")
Output-
Practical-17
Object- Write a program to find the greater number among the three numbers in
python.
Program
-n1=3
n2=4
n3=6
if(n1>n2):
if(n1>n3)
:
print("n1 is greater number")
else:
print("n3 is greater number")
elif(n2>n3):
print("n2 is greater number")
else:
print("n3 is greater number")
Output-
Practical-18
Object- Write a program for print the table of given number in python.
Program-
list=[1,2,3,4,5,6,7,8,9,10]
n=2
for i in list:
table=n*i
print(table)
Output-
Practical-19
Object- Write a program for factorial of given number in python.
Program-
num=5
factorial=1
for i in range(1,num+1):
factorial=factorial*i
print("the factorial of",num,"is:",factorial)
Output-
Practical-20
Object- Write a program for Fibonacci series in
python.Program-
num=5
n1=0
n2=1
count=0
while(count<num):
n3=n1+n2
print(n3)
n1=n2
n2=n3
count+=1
Output-
Practical-21
Object- Write a program for File Handling in python.
Read the file-
f=open("welcome.txt",)
print(f.read())
Output-