Db EXP 3 - Lecture notes 2 PDF

Title Db EXP 3 - Lecture notes 2
Course Computer Science II
Institution Xavier University
Pages 6
File Size 539.1 KB
File Type PDF
Total Downloads 62
Total Views 131

Summary

dbms...


Description

EXPERIMENT : ONE (LO2)

AIM: CREATE AND POPULATE DATABASE USING DATA DEFINITION LANGUAGE (DDL) AND DATA MANIPULATION LANGUAGE(DML).

THEORY: DATABASE AND MY SQL Databases are useful for storing information categorically. A company may have a database with the following tables:    

Employees Products Customers Orders

MySQL        

MySQL MySQL MySQL MySQL MySQL MySQL MySQL MySQL

is a database system used on the web is a database system that runs on a server is ideal for both small and large applications is very fast, reliable, and easy to use uses standard SQL compiles on a number of platforms is free to download and use is developed, distributed, and supported by Oracle Corporation

Database Queries A query is a question or a request. We can query a database for specific information and have a recordset returned.

Look at the following query (using standard SQL): SELECT LastName FROM Employees The query above selects all the data in the "LastName" column from the "Employees" table. These SQL commands are mainly categorized into four categories as discussed below:

1.

DDL(Data Definition Language) :

DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in database. Examples of DDL commands: CREATE – is used to create the database or its objects (like table, index,  function, views, store procedure and triggers). Eg. CREATE DATABASE database_name;

database_name: name of the database

 DROP – is used to delete objects from the database. Eg. DROP TABLE table_name; table_name: Name of the table to be deleted. DROP DATABASE database_name; database_name: Name of the database to be deleted.

 ALTER-is used to alter the structure of the database. Eg. ALTER TABLE table_name MODIFY column_name column_type; TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed. Eg. TRUNCATE TABLE table_name; table_name: Name of the table to be truncated. 

COMMENT –is used to add comments to the data dictionary.  Eg. /* multi line comment another comment */ SELECT * FROM Customers;



RENAME –is used to rename an object existing in the database.

Eg. ALTER TABLE table_name RENAME COLUMN old_name TO new_name;

2.

DML(Data Manipulation Language) :

The SQL commands that deals with the manipulation of data present in database belong to DML or Data Manipulation Language and this includes most of the SQL statements. Examples of DML:  SELECT – is used to retrieve data from the a database. Eg. SELECT * FROM table_name; SELECT ROLL_NO, NAME, AGE FROM Student;

INSERT – is used to insert data into a table.  Eg. INSERT INTO Student VALUES ('5','HARSH','WEST BENGAL','XXXXXXXXXX','19');  UPDATE – is used to update existing data within a table. Eg. UPDATE Student SET NAME = 'PRATIK' WHERE Age = 20; DELETE – is used to delete records from a database table.  Eg. DELETE FROM Student WHERE NAME = 'Ram';

CONCLUSION: Thus we have sucessfully understood the concepts of Data definition language and Data manipulaton language commands and have implemented all the above associated quiries in our practicals. The working and screenshots of a sample database has been attached behind.

OUTPUT:...


Similar Free PDFs