0% found this document useful (0 votes)
35 views10 pages

PST Assignment 1

The document defines primary key, candidate key and super key. It explains that a primary key uniquely identifies each record in a table and cannot contain NULL or duplicate values. A candidate key can contain NULL values but must uniquely identify each record. A super key can identify multiple records but may contain duplicate or NULL values.

Uploaded by

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

PST Assignment 1

The document defines primary key, candidate key and super key. It explains that a primary key uniquely identifies each record in a table and cannot contain NULL or duplicate values. A candidate key can contain NULL values but must uniquely identify each record. A super key can identify multiple records but may contain duplicate or NULL values.

Uploaded by

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

1. Define Priray key , Carndedate key & Supor key.

PRIMARY KEY
msre than ene candidate key, in nelation
Thee an be
eut of hich one can be chaen as dhe primay key.
" t åa wrique key.
idertyfu erly one tupe at a tme.
Tt cannat be NULL
t has he dupleate values, it has Uniqe values.
SUPER KEY
a
The set of attibutes that can
tuple is krsn as Super key. A supe key k a quaup
Koy tat ldentfiens es in
of sigde or nultiple kajs
a tible

" II suppert NULL values. key but vice vesa


ve ß nt tue.
Acendidate key i a super keu
zes moe attibutes to the cardidate
generits e super key.
CANDIDATE KEY
mirimal set of attibutes dat can
The
a atgle io kueun as candidate kes.
" It a inimal &uper key.
It muat contain nigue vales.
" IIt can centain NULL valuea.
IH a per key with no epeated cata.
keya.
" A table can hae hultiple candidate sirgle
table mat hare at Jeat a
candiate ky.
" Every
'NULL in database.
2. What s
In SQL Hhere may be
t de
at ht have vales o data fer ony 814
tae fields ae termed as aa NULL VOl
and these
NULL Vales ceuld be peasible becouse ot te oe
Of data enbuy inemallin s not auailohle. a
8upgett a special value kram as NULL whit a
Lsed to eprsnt te values of attribuites rt
be unknsn et not apply to a tple.
IMPORTANCE OF NULL VALUE

I &importarnt to undeoutard that aa NLL aue


zero vlue.
difers
valse
"he NLL value i sed t 9epresent
peatble to detemine hich of
# o oftn nst sQl doe! nt
tee misring ii intended. Hence,
datingush beten de dferent meaiíg of N.
3. Wsite
Wsite code to check arhether a
zing palinthone
hot

# inclade < bits / stdctt. h>


namespace std :
Using
tkiry isPalindrome (sbing 5)
string P-S;
revNse (P. begin (), P.end 0)
if (s --P)
Yes ";

clbe

etun "'No";

3
int main ()

String S - "ABCp CBA ";


Cot c< isPalindrene (s) :
to 400 het
4, Print numbers

# include <io streaar 7>


using hamespace std ;
int man )()

nt 0;
begin i

Cout
if (ie 00)

netion 0;
Vs Hashing
5.
Tndaing
4. It &a tchnique hat t ` a tehnigne tat
Hodin
alleus to qutck netnve alleus to sesch lcatin of
seCds fxem 'database desied data en disk witheut
inder sttne
2. It uses data
to hald eference It L3es mathtmatcal functrs
block.
addass of dk kneen as hash funoten to
calculate diredt locatin of vecerb.
3. It i not considered beit It i cenaideed beat fo
fr dange databasas ard it Jarge databases.
is
god fr snal! databuia.
4 Typa of indedrg ndhidas Typca of hashiny kncldes
oleed ndaings pinany statit and djpanle haabing
irdadngs sucndaxy indaig
cluteld trdaing
5. Its main puopose is t Its rain pwpse is to se
provide basis for bothma prblim tt egurize
rapid andem lockups od data into caily deanchable
ceD of odeud
etficiert acces bucets.
6. Explain this ' pointer.
preqramning, 'Bhis' is a keyuond that sefers
&
In Ctt nce of he clás.
Lnst nce
te the Cuvient lngth
paramler
It can be sed to pass cuvert object as a
methsd.
ancther nethed
inatance vawiable.
can be sed to nefer cuert cls
can be used te declare lndexers.
IH
EXAMPLE
# Incude < iosteam >
Using ntmcspace std:
class Eployee
public :
int id ;
string name;
fleat salary ;
Eplaye (it id, stig rame, flot salany)
this ’ id = id ;
thi's name hame
this
salauy salaryi
void diplay () ( < name < sdlauy < ondl;
3 3;
int main (votd ) {
"Sonu 390000 );
Emplye el Employee (104, "Nakl
=

Employee e2 = Enplbyee ( 102 , " , 5000);


ed. dspley () :
e2. display 0:
0;neTuvn
Li] aor <<Cout
itt) 0; i- Cint tr
t+]; [x
iin
mi p
itt) i<n; i-n-
; k (int fer
=0; X
Lx++
J:
<n
; X ; 0 (int for
K; - Xirnt
li]; av Li] Ternp
itt) <k; i0;
i (int for
(K]:
3; - kint
[o]); (on Sizeof (avm)/ Sizeof n int
; 7060, 50, 40, 30, 20, 0. LJ an nt
)main int
nnespace
istd
treaen
> <los include #
ght) (left
on Retate 7.
8. Reverse a slüng
sting using
sing Recunslon.
# inclde <ios tream >
Aaing naes pace std;
Void tecLwLiine Rewense ( atuing s : int i- 0 )
int n . stn. length ():
if (i-- nf(2)
netion
Slap ( str [r] sth Lni- 4]);
ecsüe Raerse st , i+ 1):

it maà )()

stsing stn -
9ersivekeverse (sty);
Cout << st
etm 0;
9. Remoe duplicates fron a
# include < bits / stdctt.h
Using nancpace std :
chor * neneve Duplicat (chan stn (), int n)
int ndex = 0;
for (int i: 0; i<n; itt)
int i:
for (f-0; j<1; jtt)
if (stn C] =stn LË] )
byeak i

sta [ inde ++] = str [i];

int man ()
chan str []: "Hells World ";
int n- size of (st)/ Stzeof (str CoJ);
K ere Duplicate ( Stn, n);
Cout <
sretsn O;
10. Revense wond na king ?
# inclde < stdc ttih?
Using hame space std ;
sting 91evSe stiy (striny te)
ieNRe (str. begin (), stn. erd 0);
stn . inset (stn. end 0, );
it n =stu. length 0;
=

int i 0;
fer (it i- 0; icn; ir+)
If (str [J ")

(stn. bayi ()O+j, stn. byin () +1);

s(.pop- back ();


netvn stn ;
int main )()
" Helle ;
stning NeUeNESring (stn);

netivn O;

You might also like