0% found this document useful (0 votes)
12 views

SQL 1

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

SQL 1

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

SQL Introduction

KE-01 KE-SQL
Software used for Practical Implementation
• MySQL
• Oracle
DATABASE SYSTEM

• Database is a shared & organized collection of logically related data

• Database Management System is a software for storing and


retrieving user’s data while considering appropriate security measures.
Ex:- Oracle, MS SQL, MongoDB, MySQL etc

• An Application Program interacts with a database by issuing an


appropriate request (typically a SQL statement)
Relational Database Management System
• RDBMS: A database management system that manages data as
a collection of tables in which all relationships are represented
by common values in related tables.
• Relational Model represents how data is stored in Relational
Databases. A relational database stores data in the form of
relations (tables).
Table name
Attribute names

Representation of Data in RDBMS


Product
PName Price Category Manufacturer

Gizmo $19.99 Gadgets GizmoWorks

Powergizmo $29.99 Gadgets GizmoWorks

SingleTouch $149.99 Photography Canon

MultiTouch $203.99 Household Hitachi

Tuples or rows
RDBMS

What is Relational Model?


•Relational Model represents how data is stored in Relational Databases.
A relational database stores data in the form of relations (tables).
Consider a relation STUDENT with attributes ROLL_NO, NAME,
ADDRESS, PHONE and AGE as shown below
Student ROLL_NO NAME ADDRESS PHONE AGE
1 RAM DELHI 9455123451 18
2 RAMESH GURGAON 9652431543 18
3 SUJIT ROHTAK 9156253131 20
4 SURESH DELHI 18
RDBMS….
Important Terminologies STUDENT Relation/Table
ROLL_NO NAME ADDRESS PHONE AGE
1 RAM DELHI 9455123451 18
2 RAMESH GURGAON 9652431543 18
3 SUJIT ROHTAK 9156253131 20
4 SURESH DELHI 18

1. Attribute: Attributes are the characteristics or properties that define a relation. e.g.; ROLL_NO, NAME
2. Relation Schema: A relation schema represents name of the relation with its attributes. e.g.; STUDENT (ROLL_NO, NAME,
ADDRESS, PHONE and AGE) is relation schema for STUDENT. If a schema has more than 1 relation, it is called Relational Schema.
3. Tuple: Each row in the relation is known as tuple. The above relation contains 4 tuples, one of which is shown as
1 RAM DELHI 9455123451 18
4. Relation Instance: The set of tuples of a relation at a particular instance of time is called as relation instance. Table 1 shows the
relation instance of STUDENT at a particular time. It can change whenever there is insertion, deletion or updation in the
database.
5. Degree: The number of attributes in the relation is known as degree of the relation. The STUDENT relation defined above has
degree 5.
6. Cardinality: The number of tuples in a relation is known as cardinality. The STUDENT relation defined above has cardinality 4.
RDBMS….
STUDENT Relation/Table

Important Terminologies ROLL_NO NAME ADDRESS PHONE AGE


1 RAM DELHI 9455123451 18
2 RAMESH GURGAON 9652431543 18
3 SUJIT ROHTAK 9156253131 20
4 SURESH DELHI 18
7. Column: Column represents the set of values for a particular attribute. The column ROLL_NO is extracted from
relation STUDENT. ROLL_NO
1
2
3
4

8. NULL Values: The value which is not known or unavailable is called NULL value. It is represented by blank space. e.g.; PHONE of
STUDENT having ROLL_NO 4 is NULL.
9. Domain of an attribute: The possible values an attribute can take in a relation is called its domain. For Example, domain of AGE
can be from 18 to 40.
RDBMS Terminologies summery

A collection of relations with distinct relation names is called as


Relational Model.
SQL (Structured Query Language)
• The standard for relational database management systems (RDBMS)
• SQL (Structured Query Language) is used to perform operations on the
records stored in the database such as updating records, deleting records,
creating and modifying tables, views, etc.
• SQL is just a query language; it is not a database. To perform SQL
queries, you need to install any database, for example Oracle, MySQL,
MongoDB, PostGre SQL, SQL Server, DB2, etc.
SQL Statements
• Structured Query Language (SQL) provides four types of languages
based on type of operation to be performed on a database. These
languages can be considered as subsets of SQL and logical groups
only.
TYPES OF SQL COMMAND
MySQL
• MySQL is a relational database management system based on the
Structured Query Language, which is the popular language for
accessing and managing the records in the database.
• MySQL is open-source and free software. It is supported by Oracle
Company.
How MySQL Works?
• MySQL follows the working of Client-Server Architecture.
• The working of MySQL database with MySQL Server are as follows:
• MySQL creates a database that allows you to build many tables to store and manipulate data and
defining the relationship between each table.
• Clients make requests through the GUI screen or command prompt by using specific SQL expressions
on MySQL.
• Finally, the server application will respond with the requested expressions and produce the desired
result on the client-side.
Steps to install MySQL

You might also like