CSE 210 Lab 01
CSE 210 Lab 01
2 Problem analysis
Database is a key course of computer science. At the beginner level, most of the students are not familiar with
how to use database in computer system. This section helps you get started with a very common database
system named MySQL. We will start installing MySQL, and creating a database in the MySQL server for
practicing.
PL/SQL was developed by modeling concepts of structured programming, static data typing, modularity,
exception management, and parallel (concurrent) processing found in the Ada programming language. The Ada
programming language, developed for the United States Department of Defense, was designed to support military
real-time and safety-critical embedded systems, such as those in airplanes and missiles. The Ada programming
language borrowed significant syntax from the Pascal programming language, including the assignment and
comparison operators and the single-quote delimiters.
3 Procedure
If you want to install MySQL on Windows environment, using MySQL installer is the easiest way. MySQL
installer provides you with an easy-to-use wizard that helps you to install MySQL with the following components:
• MySQL Server
• All Available Connectors
https://www.apachefriends.org/download.html
Required toll are available for all operating systems in the above link.
After installation of the downloaded XAMPP, you have to run the XAMPP control panel system. It will
be like the Figure 2.
To start the service, you have to press the Start button of the Apache and MySQL module. Now, the system
is ready to work with.
3.1 Block
PL/SQL is a blocked programming language. Program units can be named or unnamed blocks. Unnamed
blocks are known as anonymous blocks and are labeled so throughout the book. The PL/SQL coding style
differs from that of the C, C++, and Java programming languages. For example, curly braces do not delimit
blocks in PL/SQL.
Anonymous-block programs are effective in some situations. You typically use anonymous blocks when
building scripts to seed data or perform one-time processing activities.They are also effective when you want to
nest activity in another PL/SQL blocks execution section. The basic anonymous-block structure must contain
an execution section.
You can also put optional declaration and exception sections in anonymous blocks. The following illustrates
an anonymous-block prototype:
4 Implementations
4.1 Practicing With XAMPP
To start the practice session, you have to press the Admin button of MySQL module or you have to use the
following link in your web browser: http://localhost/phpmyadmin/
You will get a web page like Figure 3 in your tab. Now, to create a database, you have to select the New
option in phpMyAdmin panel (Upper most option in the left side of the web page). Then, you have to input
a name in the Database name field as your wish and press the Create button. After that, to input data in
your required structure, you have to create table with table name and required number of column. For this,
you have to open SQL option and write necessary syntax.
1 [DECLARE]
2 declaration_statements
3 BEGIN
4 execution_statements
5 [EXCEPTION]
6 exception_handling_statements
7 END;
8 /
9 Lets write out first block that will do nothing:
10
11 BEGIN
12 NULL;
13 END;
14 /
USE lab2
CREATE TABLE Student(StudentID int, LastName varchar(20), FirstName varchar(20), Address var-
char(50), City varchar(20));
DESCRIBE student;
INSERT INTO ‘student‘ (‘StudentID‘, ‘LastName‘, ‘FirstName‘, ‘Address‘, ‘City‘) VALUES (’1001’,
’Das’, ’Utsha’, ’704, Shamim Shoroni, West Shewrapara’, ’Dhaka’);
We also want to insert an another student details in Student table like StudentID: 1002, LastName:
Hasan, FirstName: Md. Mehedi, Address: 102, Shapla Shoroni, West Shewrapara, City: Dhaka,
we have to write command as bellow:
INSERT INTO ‘student‘ (‘StudentID‘, ‘LastName‘, ‘FirstName‘, ‘Address‘, ‘City‘) VALUES (’1002’,
’Hasan’, ’Md. Mehedi’, ’102, Shapla Shoroni, West Shewrapara’, ’Dhaka’);
In this way, we can insert many student details in the Student table.
6 Lab Task (Please implement yourself and show the output to the
instructor)
1. Create a database named "University"
2. Create a Table named "Teacher" with attributes named TeacherID, Name, Designation, Address, and
Email.
3. Create a Table named "Student" with attributes named StudentID, Name, Address, and Phone.
4. Insert at least five entities in each table.
5. Drop each table of the database.
2. You have to create a table named "Teacher" with attributes named TeacherID, Name, Designation, Ad-
dress, and Email. You must use proper data type and size.
3. You have to create a table named "Student" with attributes named StudentID, Name, Address, and
Phone. You must use proper data type and size.
4. You have to insert at least five tuples both in Student and Teacher table.
8 Policy
Copying from internet, classmate, seniors, or from any other source is strongly prohibited. 100% marks will be
deducted if any such copying is detected.