SQL and Database
SQL and Database
Harsh 1 100
Raghav 3 99
Abhinandan 23 01
Bhanupriya 7 00
Hemant 2 73
Terminologies
1. Relation : A table storing logically related data.
2. Domain : Pool of values from which the actual values appearing in
a given column are drawn.
3. Tuple : row
4. Attribute : Column
5. Degree : no. of rows/tuples.
6. Cardinality : no. of columns/attributes.
Terminologies
1. View : A virtual table that doesn’t really exist, but it’s used to view the
base table or tables derived from one or more base tables.
2. Primary : One or more attributes that can uniquely identify tuples within
key the table.
3. Candidate : All attribute combinations inside a table that are candidates to
key become primary key.
4. Alternate : A candidate key which is not primary key.
key
5. Foreign : A non-key attribute whose values are derived from the primary
key key of some other table, is called foreign key in its current table.
SQL
SQL(Structured Query Language) is a database language that is recognised by nearly
all RDBMSs(Relational DataBase Management System).
It contains set of commands that enables us to create and operate on relational
databases.
*DCL and DQL are beyond scope of syllabus, we’ll study it later sometime.
Important Data Types in MySQL
SELECT what_to_select
FROM which_table Name
WHERE conditions_to_satisfy; Harsh SELECT Name
FROM student
Raghav
Hemant
Name rollno marks
Harsh 141 97
Harsh 141 97
Hemant 146 97
Hemant
90 & 98 are inclusive
Name rollno marks
Harsh 141 97
Harsh 141 97
97 2 97 rollno int
99 1 99 marks int
Harsh 141 97
Hemant 146 97
Harsh 141 97
Hemant 146 97
Hemant Hemant
Name rollno marks
Harsh 141 97
Hemant 146 97