P_ID P_NAME
1 Joe
2Annie
P_ID C_NAME DOB
1 Jennifer 21.3.1998
2 john 01.08.2000
2 Lisa 17.4.2004
2 Betty 29.11.1999
DATA wa_sflight TYPE sflight.
SELECT * FROM sflight
INTO wa_sflight.
ENDSELECT.
RELATIONAL DATABASE
• Relationaldatabase use tables to store information.
• Originally , database were flat .
• - Information was stored in one long text .
• - Each entry is separated by special character , such as a vertical bar.
• For example :- Lname , fname , age , salary| smith , john , 35 , $280 | Doe , jane ,
28 , $250 | Brown , scott , 41 , $450 | smith , adam , 26 , $320
5.
Lname Fname AgeSalary
smith john 35 $280
doe jane 28 $250
brown scott 41 $350
smith John 32 $280
6.
KEY
• Every rowin a table has
one field with a value
unique in the table .
Roll no Name Age
21 ankitha 9
22 Nikitha 10
23 sachin 9
7.
FOREIGN KEY
• Foreignkey is a field or
collection of field in a
table that refers to the
primary key of the other
table.
8.
TYPES OF RELATIONS
•Three types of relations :
1 - One to one relation:
• it’s a relation , where one row in table
is related to exactly one row in another
table .
9.
2 . Oneto many ( 1 : n):
• A one-to-many relationship exists between a pair of tables when a single record in the
first table can be related to one or more records in the second table, but a single
record in the second table can be related to only one record in the first table.
10.
3 . Manyto Many ( m : n ) relation :
A pair of tables bears a many-to-many relationship when a single record in the first table can be
related to one or more records in the second table and a single record in the second table can be
related to one or more records in the first table.