Practical 2
Practical 2
Practical 2
CLASS : TE
DIV : C
Practical 2
Problem Statement : Design and develp SQL-DDL statements which demostrate the
use of SQL object such as table, view, index, sequence, synonym.
Output
CREATE DATABASE
CREATE TABLE
UPDATE RECORDS
DELETE RECORD
mysql> delete from colleges where id=3;
Query OK, 1 row affected (0.12 sec)
RENAME TABLE
TRUNCATE TABLE
DROP TABLE
SHOW DATABASE
USE DATABASE
mysql> use sandip;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
SHOW TABLES
CREATED STRUCTURE(TABLE)
ALTER COLUMN
UPDATE COLUMN
DROP (ALTER)
mysql> alter table student drop age;
Query OK, 0 rows affected (0.26 sec)
Records: 0 Duplicates: 0 Warnings: 0
CREATE VIEW
CREATE INDEX
SHOW INDEX
DROP INDEX
mysql>
SEQUENCE CREATE
mysql> create table college (roll_no int not null auto_increment, name varchar(20),
age int, primary key(roll_no));
Query OK, 0 rows affected (0.42 sec)
mysql> create table college1 (roll_no int not null auto_increment, name varchar(20),
year_established int, primary key(roll_no));
Query OK, 0 rows affected (1.05 sec)
SHOW SEQUENCE
+---------+-------+------------------+
| roll_no | name | year_established |
+---------+-------+------------------+
| 1 | zeal | 2010 |
| 2 | coep | 1999 |
| 3 | pecoe | 1999 |
+---------+-------+------------------+
3 rows in set (0.00 sec)