0% found this document useful (0 votes)
3 views7 pages

Database 12

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Database 12

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Relations: Tables in a database

Domain: A domain is the sets of values from which the actual values appearing in a given column are
drawn.

Tuple: A row in a relation.

Attribute: A column in a relation.

Primary Key: A column or set of columns that uniquely identifies a row within a table is called
primary key.

Candidate Key: Candidate keys are set of fields (columns with unique values) in the relation that are
eligible to act as a primary key.

Alternate Key: A candidate key that is not the primary key is called alternate key.

 Cardinality: Number of tuples OR Number of rows in a table.

1)To show the available tables in the database:-

SHOW tables;

2) CREATING DATABASE:

In MySQL we can create the databases using CREATE DATABASE statement.

Syntax: CREATE DATABASE ;

Example: CREATE DATABASE Bank;

3)OPENING DATABASE:

Syntax: USE ; Example: USE Bank;

4)DROPPING DATABASES:

To remove the entire database we use the DROP DATABASE statement.

Syntax: DROP DATABASE ; Example: DROP DATABASE Bank;

5)Creating Tables in MySQL:

Example:CREATE TABLE EMPLOYEE(Ecode int(6), Ename varchar(30), Dept varchar(30), city


varchar(25), sex char(1), DOB Date, salary float(12,2) );
LECTURES:

Q1.DIFFERENTIATE BETWEEN DELETE AND DROP

#DROP:USED TO REMOVE OR DELETE THE TABLE COMPLETELY .IF U DROP A TABLE ALL THE ROWS
AND THE STRUCTURE GETS DELETED

SYNTAX;

DROP TABLE<table name>;

EXAMPLE:

DROP TABLE student;

#DELETE:USED TO DELETE ROWS FROM A TABLE

SYNTAX:

DELETE FROM <TABLE NAME>

WHERE <CONDITION>;

EXAMPLE;

DELETE FROM STUDENT

WHERE ROLL NO=2

Q2.

You might also like