Professional Documents
Culture Documents
ASSIGNMENT-1
ANS1) SQL (Structured Query Language) is a standardized programming language that's used to
manage relational databases and perform various operations on the data in them. The uses of
SQL include modifying database table and index structures; adding, updating and deleting rows
of data; and retrieving subsets of information from within a database for transaction processing
and analytics applications. Queries and other SQL operations take the form of commands written
as statements -- commonly used SQL statements include select, add, insert, update, delete,
create, alter and truncate. SQL became the de facto standard programming language
for relational databases after they emerged in the late 1970s and early 1980s. Also known as
SQL databases, relational systems comprise a set of tables containing data in rows and columns.
Each column in a table corresponds to a category of data -- for example, customer name or
address -- while each row contains a data value for the intersecting column.
SQL commands and syntax-SQL commands are divided into several different types, among them
data manipulation language (DML) and data definition language (DDL) statements, transaction
controls and security measures. The DML vocabulary is used to retrieve and manipulate data,
while DDL statements are for defining and modifying database structures. The transaction
controls help manage transaction processing, ensuring that transactions are either completed or
rolled back if errors or problems occur.
1. Relational Database System: Like almost all other database systems on the market, My
SQL is a relational database system.
2. Client/Server Architecture: My SQL is a client/server system. There is a database server
(My SQL) and arbitrarily many clients (application programs), which communicate with
the server; that is, they query data, save changes, etc. The clients can run on the same
computer as the server or on another computer (communication via a local network or the
Internet).
3. SQL compatibility: My SQL supports as its database language -- as its name suggests –
SQL (Structured Query Language). SQL is a standardized language for querying and
updating data and for the administration of a database. There are several SQL dialects
(about as many as there are database systems). My SQL adheres to the current SQL
standard, although with significant restrictions and a large number of extensions.
43390301717Page 1
ISM PRACTICAL FILE
ANS2) SQL data types can be broadly divided into following categories.
1. Numeric data types such as int, tinyint, bigint, float, real etc.
2. Date and Time data types such as Date, Time, Datetime etc.
3. Character and String data types such as char, varchar, text etc.
4. Unicode character string data types, for example nchar, nvarchar, ntext etc.
5. Binary data types such as binary, varbinary etc.
6. Miscellaneous data types – clob, blob, xml, cursor, table etc.
Not all data types are supported by every relational database vendors. For example, Oracle
database doesn’t support DATETIME and My SQL doesn’t support CLOB data type. So
while designing database schema and writing SQL queries, make sure to check if the data
types are supported or not.
Data types listed here doesn’t include all the data types, these are the most popularly used
data types. Some relational database vendors have their own data types that might be not
listed here. For example, Microsoft SQL Server has money and small money data types
but since it’s not supported by other popular database vendors, it’s not listed here.
Every relational database vendor has it’s own maximum size limit for different data types,
you don’t need to remember the limit. Idea is to have the knowledge of what data type to
be used in a specific scenario.
Q3) Create student table and modify the structure of the table.
TABLE CREATED
43390301717Page 2
ISM PRACTICAL FILE
ALTER TABLE
43390301717Page 3
ISM PRACTICAL FILE
Q4) Create employee table and modify the structure of the table.
TABLE CREATED
43390301717Page 4
ISM PRACTICAL FILE
ALTER TABLE
43390301717Page 5
ISM PRACTICAL FILE
43390301717Page 6
ISM PRACTICAL FILE
ASSIGNMENT-2
TABLE CREATED
VALUES INSERTED
43390301717Page 7
ISM PRACTICAL FILE
43390301717Page 8
ISM PRACTICAL FILE
43390301717Page 9
ISM PRACTICAL FILE
43390301717Page 10
ISM PRACTICAL FILE
43390301717Page 11
ISM PRACTICAL FILE
43390301717Page 12
ISM PRACTICAL FILE
43390301717Page 13
ISM PRACTICAL FILE
43390301717Page 14
ISM PRACTICAL FILE
RETRIEVE ALL ROWS WHERE FIRST NAME CONTAINS THE WORD ‘RAJ’
RETRIEVE ALL ROWS WHERE NAME FIELD CONTAINS THE WORD ‘RAJESH’
43390301717Page 15
ISM PRACTICAL FILE
43390301717Page 16
ISM PRACTICAL FILE
43390301717Page 17
ISM PRACTICAL FILE
43390301717Page 18
ISM PRACTICAL FILE
43390301717Page 19
ISM PRACTICAL FILE
43390301717Page 20
ISM PRACTICAL FILE
ASSIGNMENT-3
TABLE CREATED
VALUES INSERTED
43390301717Page 21
ISM PRACTICAL FILE
43390301717Page 22
ISM PRACTICAL FILE
43390301717Page 23
ISM PRACTICAL FILE
43390301717Page 24
ISM PRACTICAL FILE
43390301717Page 25
ISM PRACTICAL FILE
43390301717Page 26
ISM PRACTICAL FILE
43390301717Page 27
ISM PRACTICAL FILE
43390301717Page 28
ISM PRACTICAL FILE
43390301717Page 29
ISM PRACTICAL FILE
43390301717Page 30
ISM PRACTICAL FILE
ASSIGNMENT-4
TABLE CREATED
VALUES INSERTED
43390301717Page 31
ISM PRACTICAL FILE
AVERAGE SALARY
43390301717Page 32
ISM PRACTICAL FILE
TOTAL SALARY
43390301717Page 33
ISM PRACTICAL FILE
43390301717Page 34
ISM PRACTICAL FILE
43390301717Page 35
ISM PRACTICAL FILE
43390301717Page 36
ISM PRACTICAL FILE
UPDATE THE COMMISSION TO 10%OF SALARY FOR ALL THE EMPLOYEES HAVING
SALARY GREATER THAN 50000
43390301717Page 37
ISM PRACTICAL FILE
43390301717Page 38
ISM PRACTICAL FILE
FIND THE DIFFERENCE BETWEEN HIGHEST AND LOWEST SALARIES FOR EACH
DEPT
LIST AVERAGE SALARY FOR ALL THE DEPTS WHICH HAVE MORE THAN 5 PEOPLE
43390301717Page 39
ISM PRACTICAL FILE
LIST JOBS OF ALL THE EMPLOYEES WHERE MAXIMUM SALARY IS MORE THAN
40000
43390301717Page 40
ISM PRACTICAL FILE
43390301717Page 41
ISM PRACTICAL FILE
ASSIGNMENT-5
43390301717Page 42
ISM PRACTICAL FILE
43390301717Page 43
ISM PRACTICAL FILE
43390301717Page 44
ISM PRACTICAL FILE
43390301717Page 45
ISM PRACTICAL FILE
43390301717Page 46