Dbms Unit
Dbms Unit
UNIT I
INTRODUCTION TO DBMS
Purpose of Database System-Views of Data -Data models – Database System Architecture-
Introduction to relational Databases-Relational Model-Keys-Relational Algebra-SQL
Fundamentals-Advanced SQL Futures-Embedded SQL-Dynamic SQL.
INTRODUCTION
A Database is a collection of related data organized in a way that data can be easily accessed,
managed and updated. Any piece of information can be a data, for example name of your school.
Database is actualy a place where related piece of information is stored and various operations can
be performed on it.
Database Management System (DBMS): The software which is used to manage database is
called Database Management System (DBMS). For Example, MySQL, Oracle etc. are popular
commercial DBMS used in different applications.
Data Definition: It helps in creation, modification and removal of definitions that define the organization of
data in database.
Data Updation: It helps in insertion, modification and deletion of the actual data in the database.
Data Retrieval: It helps in retrieval of data from the database which can be used by applications for various
purposes.
User Administration: It helps in registering and monitoring users, enforcing data security, monitoring
performance, maintaining data integrity, dealing with concurrency control and recovering information
corrupted by unexpected failure.
Users: Users may be of various type such as DB administrator, System developer and End
users.
Database application : Database application may be Personal, Departmental, Enterprise and
Internal
DBMS: Software that allow users to define, create and manages database access, Ex: MySql,
Oracle etc.
Database: Collection of logical data.
Functions of DBMS
Advantages of DBMS
Disadvantages of DBMS
Complexity
Costly
Large in size
Database Applications:
DBMS
1. DBMS is a collection of data and user is not required to write the procedures for Managing
the database.
2. DBMS provides an abstract view of data that hides the details.
3. DBMS is efficient to use since there are wide varieties of sophisticated techniques to store
and retrieve the data.
4. DBMS takes care of Concurrent access using some form of locking.
5. DBMS has crash recovery mechanism, DBMS protects user from the effects of system
failures.
6. DBMS has a good protection mechanism.
DBMS = Database Management System
RDBMS = Relational Database Management System
DBMS Utilities
A data loading utility:
Which allows easy loading of data from the external format without writing programs.
A backup utility:
Which allows to make copies of the database periodically to help in cases of crashes and disasters.
Recovery utility:
Which allows to reconstruct the correct state of database from the backup and history of
transactions.
Monitoring tools:
Which monitors the performance so that internal schema can be changed and database access can
be optimized.
Data integrity
This is one of the most important characteristics of database management system. Integrity ensures
the quality and reliability of database system. It protects the unauthorized access of database and
makes it more secure. It brings only the consistence and accurate data into the database.
In File System, the structure of the data file is embedded in the access programs.
A database system contains not only the database itself but also a complete definition or
description of database structure and constraints. This definition is stored in System catalog which
contains information such as structure of each file, type and storage format of each data item and
various constraints on the data. Information stored in the catalog is called Meta-Data.
DBMS is not written for specific applications, hence it must refer to catalog to
know structure of file etc., and hence it can work equally well with any number of database
applications.
(iii) Data Isolation or Abstraction:
Conventional File processing systems do not allow data to be retrieved in
convenient and efficient manner. More responsive data retrieval systems are required for general
use.
The structure of the data file is embedded in the access programs. So any changes to
the structure of a file may require changing all programs that access this file. Because data are
scattered in various files and files may be in different formats, writing new application programs to
retrieve appropriate data is difficult.
But the DBMS access programs do not require such changes in most cases. The
structure of data files is stored in DBMS catalog separately from the access programs. This
property is known as program data independence.
Operations are separately specified and can be changed without affecting the
interface. User application programs can operate on data by invoking these operations regardless
of how they are implemented. This property is known as program operation independence.
Program data independence and program operation independence are together known as data
independence.
(iv) Enforcing Integrity Constraints:
The data values must satisfy certain types of consistency constraints.
In File System, Developers enforce constraints by adding appropriate code in application
program. When new constraints are added, it is difficult to change the programs to enforce them.
In data base system, DBMS provide capabilities for defining and enforcing constraints. The
constraints are maintained in system catalog. Therefore application programs work independently
with addition or modification of constraints. Hence integrity problems are avoided.
(v) Atomicity:
A Computer system is subjected to failure. If failure occurs, the data has to be
restored to the consistent state that existed prior to failure. The transactions must be atomic – it
must happen in entirety or not at all.
II/IV SEM Page 5
CS8492-DATABASE MANAGEMENT SYSTEM
What data are stored and what relationships exist among data.
Uses high level or implementational data model.
Hides the details of physical storage structures and describes
datatypes, relationships, operations and constraints.
e.g:
type customer = record
customer_id : string;
customer_name : string;
customer_street : string;
customer_city : string;
end;
(iii) External or View Level:
includes a number of external schemas or views.
Each external schema describes the part of the database and hides the rest.
Uses high level or implementation data model.
such as an employee’s salary.
DATABASE MODEL
A Database model defines the logical design of data. The model describes,
Data
Data Relationship
Data Semantics
Data Constraints
It provides a way to describe the design of a database at the physical, logical and view
level.
Categories of data model
1. Record-based data models
Hierarchical Model
Network Model
Relational Model
1 Hierarchical Model
2 Network Model
3 Relational Model
Hierarchical Model
In this model each entity has only one parent but can have several children . At the top of hierarchy
there is only one entity which is called Root.
Advantages:
Network Model
In the network model, entities are organized in a graph, in which some entities can be accessed
through several path
The main difference of the network model from the hierarchical model is its ability to
handle many-to-many(N:N) relationships or in other words, it allow a record to have more than one
parent.
Example: Network DBMS
Advantage:
Relational Model
In this model, data is organised in two-dimesional tables called relations. The tables or relation are
related to each other.
Advantage:
Specialized users – write specialized database applications that do not fit into the
traditional data processing framework
Naive users – invoke one of the permanent application programs that have been
written previously
E.g. people accessing database over the web, bank tellers, clerical staff.
o Schema definition
o Storage structure and access method definition
o Schema and physical organization modification
o Granting user authority to access the database
o Routine maintenance.
DML compiler
3. STORAGE MANAGER
Storage manager is a program module that provides the interface between the low-level data stored
in the database and the application programs and queries submitted to the system.
The storage manager is responsible to the following tasks:
Interaction with the file manager
Efficient storing, retrieving and updating of data
II/IV SEM Page 11
CS8492-DATABASE MANAGEMENT SYSTEM
Atomicity、consistency、isolation 、durability
Failure recovery
RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and
for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft
Access.
A Relational database management system (RDBMS) is a database management system (DBMS)
that is based on the relational model as introduced by E. F. Codd.
What is a table?
The data in an RDBMS is stored in database objects which are called as tables. This table is
basically a collection of related data entries and it consists of numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a relational database.
The following program is an example of a CUSTOMERS table −
+----+----------+-----+-----------+----------+
| ID | NAME | AGE | ADDRESS | SALARY |
+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
+----+----------+-----+-----------+----------+
What is a 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 a 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 be as shown below
+-----------+
| ADDRESS |
+-----------+
| Ahmedabad |
| Delhi |
| Kota |
| Mumbai |
| Bhopal |
| MP |
| Indore |
+----+------+
SQL Constraints
Constraints are the rules enforced on data columns on a 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 can either be column level or table level. Column level constraints are applied only to
one column whereas, table level constraints are applied to the entire table.
Following are some of the most commonly used constraints available in SQL −
NOT NULL Constraint − Ensures that a column cannot have a NULL value.
DEFAULT Constraint − Provides a default value for a column when none is specified.
UNIQUE Constraint − Ensures that all the values in a column are different.
PRIMARY Key − Uniquely identifies each row/record in a database table.
FOREIGN Key − Uniquely identifies a row/record in any another database table.
CHECK Constraint − The CHECK constraint ensures that all values in a column satisfy
certain conditions.
INDEX − Used to create and retrieve data from the database very quickly.
RELATIONAL MODEL
The relational model represents the database as a collection of relations. A relation is nothing but
a table of values. Every row in the table represents a collection of related data values. These rows
in the table denote a real-world entity or relationship.
The table name and column names are helpful to interpret the meaning of values in each row. The
data are represented as a set of relations. In the relational model, data are stored as tables.
However, the physical storage of the data is independent of the way the data are logically
organized.
Some popular Relational Database management systems are:
1. Attribute: Each column in a Table. Attributes are the properties which define a relation.
e.g., Student_Rollno, NAME,etc.
2. Tables – In the Relational model the, relations are saved in the table format. It is stored
along with its entities. A table has two properties rows and columns. Rows represent
records and columns represent attributes.
3. Tuple – It is nothing but a single row of a table, which contains a single record.
4. Relation Schema: A relation schema represents the name of the relation with its
attributes.
5. Degree: The total number of attributes which in the relation is called the degree of the
relation.
6. Cardinality: Total number of rows present in the Table.
7. Column: The column represents the set of values for a specific attribute.
8. Relation instance – Relation instance is a finite set of tuples in the RDBMS system.
Relation instances never have duplicate tuples.
9. Relation key - Every row has one, two or multiple attributes, which is called relation key.
10. Attribute domain – Every attribute has some pre-defined value and scope which is
known as attribute domain
1. Domain constraints
2. Key constraints
3. Referential integrity constraints
Domain Constraints
Domain constraints can be violated if an attribute value is not appearing in the corresponding
domain or it is not of the appropriate data type.
Domain constraints specify that within each tuple, and the value of each attribute must be unique.
This is specified as data types which include standard data types integers, real numbers,
characters, Booleans, variable length strings, etc.
II/IV SEM Page 15
CS8492-DATABASE MANAGEMENT SYSTEM
Example:
Create DOMAIN CustomerName
CHECK (value not NULL)
The example shown demonstrates creating a domain constraint such that CustomerName is not
NULL
Key constraints
An attribute that can uniquely identify a tuple in a relation is called the key of the table. The value
of the attribute for different tuples in the relation has to be unique.
Example:
In the given table, CustomerID is a key attribute of Customer Table. It is most likely to have a
single key for one customer, CustomerID =1 is only for the CustomerName =" Google".
CustomerID CustomerName Status
1 Google Active
2 Amazon Active
3 Apple Inactive
Modify allows you to change the values of some attributes in existing tuples.
Select allows you to choose a specific range of data.
Whenever one of these operations are applied, integrity constraints specified on the relational
database schema must never be violated.
Inset Operation
The insert operation gives values of the attribute for a new tuple which should be inserted into a
relation.
Update Operation
You can see that in the below-given relation table CustomerName= 'Apple' is updated from
Inactive to Active.
Delete Operation
To specify deletion, a condition on the attributes of the relation selects the tuple to be deleted.
Select Operation
Simplicity: A relational data model is simpler than the hierarchical and network model.
Structural Independence: The relational database is only concerned with data and not
with a structure. This can improve the performance of the model.
Easy to use: The relational model is easy as tables consisting of rows and columns is quite
natural and simple to understand
Query capability: It makes possible for a high-level query language like SQL to avoid
complex database navigation.
Data independence: The structure of a database can be changed without having to change
any application.
Scalable: Regarding a number of records, or rows, and the number of fields, a database
should be enlarged to enhance its usability.
Few relational databases have limits on field lengths which can't be exceeded.
Relational databases can sometimes become complex as the amount of data grows, and the
relations between pieces of data become more complicated.
Complex relational database systems may lead to isolated databases where the information
cannot be shared from one system to another.
KEYS
What is key
Keys are very important part of Relational database model. They are used to establish and identify
relationships between tables and also to uniquely identify any record or row of data inside a table.
A Key can be a single attribute or a group of attributes, where the combination may act as a key.
Super Key – A super key is a set of one of more columns (attributes) to uniquely identify rows in
a table.
Candidate Key – A super key with no redundant attribute is known as candidate key
Alternate Key – Out of all candidate keys, only one gets selected as primary key, remaining keys
are known as alternate or secondary keys.
Composite Key – A key that consists of more than one attribute to uniquely identify rows (also
known as records & tuples) in a table is called composite key.
Foreign Key – Foreign keys are the columns of a table that points to the primary key of another
table. They act as a cross-reference between tables.
Example:
Let's try to understand about all the keys using a simple example.
Let's take a simple Student table, with fields student_id, name, phone and age.
Super Key
In the table defined above super key would include student_id, (student_id, name), phone etc.
Confused? The first one is pretty simple as student_id is unique for every row of data, hence it
can be used to identity each row uniquely.
Next comes, (student_id, name), now name of two students can be same, but their student_id can't
be same hence this combination can also be a key.
Similarly, phone number for every student will be unique, hence again, phone can also be a key.
Candidate Key
Candidate keys are defined as the minimal set of fields which can uniquely identify each record in
a table. It is an attribute or a set of attributes that can act as a Primary Key for a table to uniquely
identify each record in that table. There can be more than one candidate key.
In our example, student_id and phone both are candidate keys for table Student.
A candiate key can never be NULL or empty. And its value should be unique.
There can be more than one candidate keys for a table.
A candidate key can be a combination of more than one columns(attributes).
Primary Key
Primary key is a candidate key that is most appropriate to become the main key for any table. It is
a key that can uniquely identify each record in a table.
For the table Student we can make the student_id column as the primary key.
Composite Key
Key that consists of two or more attributes that uniquely identify any record in a table is called
Composite key. But the attributes which together form the Composite key are not a key
independentely or individually.
In the above picture we have a Score table which stores the marks scored by a student in a
particular subject.
In this table student_id and subject_id together will form the primary key, hence it is a composite
key.
Non-key Attributes
Non-key attributes are the attributes or fields of a table, other than candidate key attributes/fields
in a table.
Non-prime Attributes
Non-prime Attributes are attributes other than Primary Key attribute(s)..
RELATIONAL ALGEBRA
Relational algebra is a procedural query language, which consists of basic set of relational
model operations. These operations enable the user to specify basic retrieval requests. It takes one
or more relations as input and result of retrieval is a relation.
The fundamental operations of relational algebra are as follows −
Select
Project
Union
Set different
Cartesian product
Rename
SQL JOIN
A JOIN clause is used to combine rows from two or more tables, based on a related column
between them.
JOIN Keyword is used in SQL queries for joining two or more tables. Minimum required
condition for joining table, is (n-1) where n, is number of tables.
Why SQL JOIN is used?
If you want to access more than one table through a select statement.
If you want to combine two or more table then SQL JOIN statement is used .it combines rows of
that tables in one table and one can retrieve the information by a SELECT statement.
The joining of two or more tables is based on common field between them.
SQL INNER JOIN also known as simple join is the most common type of join.
(INNER) JOIN: Returns records that have matching values in both tables
LEFT (OUTER) JOIN: Return all records from the left table, and the matched records
from the right table
RIGHT (OUTER) JOIN: Return all records from the right table, and the matched
records from the left table
FULL (OUTER) JOIN: Return all records when there is a match in either left or right
table
Example:
Inner Join
1.Staff table
2.Payment table
let us take two tables in this example to elaborate all the things:
CUSTOMER TABLE:
let us take an example with 2 tables table1 is CUSTOMERS table and table2 is ORDERS table.
CUSTOMER TABLE:
Here we will join these two tables with SQL RIGHT JOIN:
1. SELECT *
2. FROM table1
3. FULL OUTER JOIN table2
4. ON table1.column_name = table2.column_name;
Note:here table1 and table2 are the name of the tables participating in joining and column_name
is the column of the participating tables.
Let us take two tables to demonstrate full outer join:
table_A
A M
1 m
2 n
4 o
table_B
A N
2 p
3 q
5 r
Resulting table
II/IV SEM Page 26
CS8492-DATABASE MANAGEMENT SYSTEM
A M A N
2 n 2 p
1 m - -
4 o - -
- - 3 q
- - 5 r
Because this is a full outer join so all rows (both matching and non-matching) from both tables
are included in the output. Here only one row of output displays values in all columns because
there is only one match between table_A and table_B.
Department_id Department_name
1 IT
2 HR
3 Marketing
SQL Statement:
After executing this query , you will find the following result:
Alan 1 3 1 IT
Priyanka 2 2 1 IT
Rajesh 3 5 1 IT
Franklin 1 2 2 HR
Alan 1 3 2 HR
Priyanka 2 2 2 HR
Rajesh 3 5 2 HR
Franklin 1 2 3 Marketing
Alan 1 3 3 Marketing
Priyanka 2 2 3 Marketing
Rajesh 3 5 3 Marketing
SQL FUNDAMENTALS
SQL is a programming language for Relational Databases. It is designed over relational algebra
and tuple relational calculus. SQL comes as a package with all major distributions of RDBMS.
SQL comprises both data definition and data manipulation languages. Using the data definition
properties of SQL, one can design and modify database schema, whereas data manipulation
properties allows SQL to store and retrieve data from database.
CREATE
Creates new databases, tables and views from RDBMS.
For example −
Create database tutorialspoint;
Create table article;
Create view for_students;
DROP
Drops commands, views, tables, and databases from RDBMS.
For example−
Drop object_type object_name;
Drop database tutorialspoint;
Drop table article;
Drop view for_students;
ALTER
Modifies database schema.
Alter object_type object name parameters;
For example−
Alter table article add subject varchar;
This command adds an attribute in the relation article with the name subject of string type.
SELECT/FROM/WHERE
INSERT INTO/VALUES
UPDATE/SET/WHERE
DELETE FROM/WHERE
These basic constructs allow database programmers and users to enter data and information into
the database and retrieve efficiently using a number of filter options.
SELECT/FROM/WHERE
SELECT − This is one of the fundamental query command of SQL. It is similar to the
projection operation of relational algebra. It selects the attributes based on the condition
described by WHERE clause.
FROM − This clause takes a relation name as an argument from which attributes are to be
selected/projected. In case more than one relation names are given, this clause corresponds
to Cartesian product.
WHERE − This clause defines predicate or conditions, which must match in order to
qualify the attributes to be projected.
For example −
Select author_name
From book_author
Where age > 50;
This command will yield the names of authors from the relation book_author whose age is
greater than 50.
INSERT INTO/VALUES
This command is used for inserting values into the rows of a table (relation).
Syntax−
INSERT INTO table (column1 [, column2, column3 ... ]) VALUES (value1 [, value2, value3 ... ])
Or
INSERT INTO table VALUES (value1, [value2, ... ])
For example −
INSERT INTO tutorialspoint (Author, Subject) VALUES ("anonymous", "computers");
UPDATE/SET/WHERE
This command is used for updating or modifying the values of columns in a table (relation).
Syntax −
UPDATE table_name SET column_name = value [, column_name = value ...] [WHERE
condition]
For example −
UPDATE tutorialspoint SET Author="webmaster" WHERE Author="anonymous";
DELETE/FROM/WHERE
This command is used for removing one or more rows from a table (relation).
Syntax −
DELETE FROM table_name [WHERE condition];
For example −
DELETE FROM tutorialspoints
WHERE Author="unknown";
EMBEDDED SQL
1. SQL provides a powerful declarative query language. However, access to a database from
a general-purpose programming language is required because,
o SQL is not as powerful as a general-purpose programming language. There are
queries that cannot be expressed in SQL, but can be programmed in C, Fortran,
Pascal, Cobol, etc.
o Nondeclarative actions -- such as printing a report, interacting with a user, or
sending the result to a GUI -- cannot be done from within SQL.
2. The SQL standard defines embedding of SQL as embedded SQL and the language in
which SQL queries are embedded is referred as host language.
3. The result of the query is made available to the program one tuple (record) at a time.
To identify embedded SQL requests to the preprocessor, we use EXEC SQL statement:
EXEC SQL embedded SQL statement END-EXEC
Note: A semi-colon is used instead of END-EXEC when SQL is embedded in C or Pascal.
5. Embedded SQL statements: declare cursor, open, and fetch statements.
EXEC SQL
END-EXEC
where amount is a host-language variable.
EXEC SQL open c END-EXEC
This statement causes the DB system to execute the query and to save the results within a
temporary relation.
A series of fetch statement are executed to make tuples of the results available to the program.
EXEC SQL fetch c into :cn, :cc END-EXEC
The program can then manipulate the variable cn and cc using the features of the host
programming language.
A single fetch request returns only one tuple. We need to use a while loop (or equivalent) to
process each tuple of the result until no further tuples (when a variable in the SQLCA is set).
We need to use close statement to tell the DB system to delete the temporary relation that held the
result of the query.
SQL statements can be embedded into an application program in two different ways:
Call Level Interface (CLI): The application program is written entirely in the host language. SQL
statements are simply strings in the host language that are passed as arguments to host language
procedures or functions from a SQL library.
Statement Level Interface (SLI): The application program is composed of a mixture of host
language statements and SQL statements and directives
SQL statements are composed of Java or C++ strings constructed and concatenated at run time
using host language.
The application uses strings or string variables as arguments of library routines that communicate
with DBMS
Standard SQL statements (static or embedded SQL): Useful when the SQL portion of
program is known at compile time
Directives (dynamic SQL): Useful when SQL portion of program not known at compile
time. Application constructs SQL statements at run time as values of host language
variables that are manipulated by directives. Try to minimize the use of dynamic SQL
because of performance.
Static SQL
You normally have a declaration section for host/SQL communication.
…some host language code…….
The embedded SQL program for above written SQL statement will be:
main()
{
exec sql include sqlca;
exec sql declare table teacher (tid char(6) not null,tname char(20),sex char(1),age
number(3),qualification char(7),salary number(7),city varchar(15));
//Display a message to user
printf("updating teacher salary who are B.Techn");
//this code executes the SQL statement
exec sql update teacher set salary=1.1*salary where qualification='B.Tech';
printf(update done");
exit();
}
Explanation
Although the above shown program is very easy to understand,
still we would like to discuss some very basic features of embedded SQL.
Problem: SQL deals with tables (of arbitrary size); host language program deals with fixed size
buffers or variables and arrays. How is the application to allocate storage for the result of a
SELECT statement since the result can be a set of tuples? with unpredictable size?
Solution: Fetch a single row at a time. The space for a single row (number and type of out
parameters) can be well defined from the schema and allocated within the application.
Problem: We still need to be able to track the individual rows within a selected result set.
Solution: Use a pointer mechanism to track the "current" row from the result set . This is usually
called a cursor.
The result set can be thought of as a collection or a list and we want to iterate through the
collection simply in a sequential manner.
DYNAMIC SQL
Dynamic SQL is a programming technique that enables you to build SQL statements dynamically
at runtime.. For example, dynamic SQL lets you create a procedure that operates on a table whose
name is not known until runtime.
Since dynamic SQL builds a query at run time, as a first step we need to capture all the inputs
from the user. It will be stored in a string variable. Depending on the inputs received from the
user, string variable is appended with inputs and SQL keywords. These SQL like string
statements are then converted into SQL query. This is done by using PREPARE statement.
For example, below is the small snippet from dynamic SQL. Here sql_stmt is a character variable,
which holds inputs from the users along with SQL commands. But is cannot be considered as
SQL query as it is still a sting value. It needs to be converted into a proper SQL query which is
done at the last line using PREPARE statement. Here sql_query is also a string variable, but it
holds the string as a SQL query.
This statement is used to compile and execute the SQL statements prepared in DB.
EXECUTE IMMEDIATE
This statement is used to prepare SQL statement as well as execute the SQL statements in DB. It
performs the task of PREPARE and EXECUTE in a single line.
int main(){
EXEC SQL INCLUDE SQLCA;
error_msg1:
printf("Student Id %d is not found", STD_ID);
printf("ERROR:%ld", sqlca->sqlcode);
printf("ERROR State:%s", sqlca->sqlstate);
exit(0);
error_msg2:
printf("Error has occurred!");
printf("ERROR:%ld", sqlca->sqlcode);
printf("ERROR State:%s", sqlca->sqlstate);
exit(0);
Different host languages supported using embedded SQL are listed below. It also shows which
version of Oracle supports embedding SQL.
TWO MARKS
1. What is database?
A database is a basic electronic storage with collection of interrelated data,
organized to provide efficient retrieval. Databases are organized by fields, records and
files or tables.
31. What is the use of embedded SQL? (MAY 2012) (NOV 2014)
A fundamental principle underlying embedded SQL, which we call the
dual-mode principle, is that any SQL statement that can be used interactively
can also be embedded in an application program.
1. Explain the system structure of a database system with neat block diagram. (DEC
2007), (MAY 2010) (MAY 2012)
2. What is a data model? Explain various data model for describing the design of a
database at the logical level. (APRIL 2008), (MAY 2010)
Department (DeptNo,Name)
(ii)Develop a View that will keep track of the department number, the number
of employees in the department, and the total basic pay expenditure for each
department.
(iii)Develop an SQL query to list the details of employees who have worked in
more than three projects on a day.
5. Create an EMPLOYEE table and write the steps for various functions in an
SQL Like add, update, delete, save and join the various attributes of an
EMPLOYEE Table.(MAY-2007)
Course File
Professor File
Registration File
---------------------------------------------------------------------------------------