Database Models (Hierarchical, Network, E/R, Relational)

એક database model એ આકાર છે જેમાં data ગોઠવાય છે: hierarchical એ કડક tree છે, network એ લવચીક web છે, E/R model એ design diagram છે, અને relational model, keys થી જોડાયેલી સરળ tables, એટલે જીત્યું કારણ કે એ query અને બદલવામાં સૌથી સહેલું છે.

10 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

એ જ data, ચાર આકાર

Meera ની દુકાનમાં customers, orders અને items છે, બધા સંબંધિત. પણ એ એક database ની અંદર કેવી રીતે ગોઠવાવું જોઈએ? ખબર પડે છે કે data ને આકાર આપવાની એક કરતાં વધુ રીત છે, અને ઇતિહાસે ઠરતાં પહેલાં ઘણી અજમાવી.

એક database model એ અંતર્ગત આકાર છે: એક tree, એક web, એક design sketch, કે tables નો એક set. syllabus જે ચારને list કરે છે એમને, અને એમાંનું એક કેમ જીત્યું એ જાણવું એ ક્લાસિક exam સવાલ છે અને એ કારણ છે કે દરેક database જે તમે ક્યારેય વાપરશો એ જેવો દેખાય છે એવો દેખાય છે.

Theory

એક library ગોઠવવાની ચાર રીતો

તમે એક library ને એક કડક family tree તરીકે ગોઠવી શકો જ્યાં દરેક ચોપડીનો બરાબર એક shelf-parent હોય (hierarchical), એક cross-references ના web તરીકે જ્યાં એક ચોપડી ઘણી બીજી સાથે link હોય (network), બનાવતાં પહેલાં દોરેલી એક architect ની blueprint તરીકે (E/R), કે reference numbers થી જોડાયેલી સાદી card-catalogue tables તરીકે (relational). બધા એ જ ચોપડીઓ રાખે છે; એ એમાં અલગ છે કે એમને શોધવી અને ફરી ગોઠવવી કેટલી સહેલી છે. Tables જીતી.

At a glance

ચાર models

Modelઆકારનોંધ
HierarchicalTree: દરેક child નો એક parentકડક; many-to-many માં નબળું
NetworkGraph: ઘણા parents ની પરવાનગીલવચીક પણ navigate કરવામાં જટિલ
E/RDesign diagramDESIGN માટે, store માટે નહીં
Relationalkeys થી જોડાયેલી tablesપ્રમુખ: સરળ + SQL

Theory

Relational કેમ જીત્યું

Relational model (E.F. Codd, 1970) data ને rows અને columns ની tables (relations) તરીકે store કરે છે, tables વહેંચાયેલી keys થી જોડાયેલી. એ એ કારણોસર જીત્યું જે રોજ મહત્વના છે:

  • સરળ: દરેક જણ એક table સમજે છે.
  • લવચીક: એક column ઉમેરો કે બે tables link કરો બધું ફરી બનાવ્યા વગર (data independence!).
  • શક્તિશાળી querying: SQL થી સમર્થિત, સવાલ પૂછવાની એક આખી ભાષા.
  • નક્કર theory: normalization નિયમો એને સાફ રાખે છે.

Hierarchical અને network models તમારી પાસે pointers હાથે navigate કરાવતા; relational તમને બસ જે જોઈએ એ describe કરવા દે છે. એટલે જ MySQL, Oracle, PostgreSQL, બધા relational, દુનિયા ચલાવે છે.

Quiz

HIERARCHICAL model માં, એક child record ના કેટલા parents હોઈ શકે છે?

  1. બરાબર એક
  2. જેટલા જોઈએ એટલા
  3. બરાબર બે
  4. કોઈ નહીં; parents હોતા જ નથી
Show the answer

બરાબર એક

Hierarchical model એ કડક tree છે: દરેક child નો બરાબર એક parent હોય છે. આ એની વ્યાખ્યાયિત મર્યાદા છે, સાચા data ને ઘણી વાર many-to-many જોઈએ (એક student ઘણા courses માં, એક course ઘણા students સાથે), જેને એક one-parent tree સાફ-સુથરું વ્યક્ત કરી શકતું નથી. Network model એ એને ઢીલું કરીને ઘણા parents ની પરવાનગી આપી. એ one-parent-સામે-ઘણા ભેદ બંને વચ્ચેનો મુખ્ય exam contrast છે.

Think first

એક tree સાથે Meera ની સમસ્યા

Meera ના data માં એક many-to-many હકીકત છે: દરેક customer ઘણા items ખરીદે છે, અને દરેક item ઘણા customers દ્વારા ખરીદાય છે. એક કડક hierarchical (tree) model અહીં કેમ સંઘર્ષ કરે છે, અને relational model એને કેવી રીતે સંભાળે છે?

Show the answer

એક tree દરેક child પર એક parent ને ફરજ પાડે છે, તો એ સ્વાભાવિક રીતે કહી શકતું નથી કે 'આ item ઘણા customers નું છે અને આ customer ના ઘણા items છે', તમે data ને ગડબડ રીતે duplicate કરવા લાગો છો. Relational model એને એક અલગ linking table (orders) થી સંભાળે છે જે customers અને items ને છૂટથી જોડવા keys વાપરે છે, કોઈ duplication નહીં, કોઈ પણ many-to-many સંબંધ સાફ-સુથરો વ્યક્ત. આ લવચીકતા બરાબર એ કારણ છે કે relational એ જૂના models ની જગ્યા લીધી.

Watch out

Marks ક્યાં કપાય છે

hierarchical (tree, એક parent) ને network (graph, ઘણા parents) સાથે ભેળવવું, સૌથી વધુ test થતો ભેદ. E/R ને એક storage model માનવું, એ એક design/conceptual model (એક diagram) છે, તમે E/R માં design કરો છો પછી relational તરીકે implement. અને 'relational કેમ લોકપ્રિય છે?' જવાબોમાં, simplicity, SQL, flexibility અને theory list કરો, ફક્ત 'એ tables વાપરે છે' નહીં. એના જનક તરીકે Codd નું નામ લેવું એ એક સારો વધારાનો mark છે.

Theory

આગળ બધું relational છે

અહીંથી, આખો subject relational model છે: આગળના lessons E/R diagrams થી DESIGN કરે છે, પછી key lessons અને normalization relational tables ને સાફ બનાવે છે, પછી Unit 4 એમને SQL થી query કરે છે. તમે જીતતા model ને શરૂઆતથી શીખો છો. આગળ: E/R model પોતે, entities, attributes અને relationships, database design ની શબ્દાવલી.

Summary

Key takeaways

  • એક database model એ આકાર છે જેમાં data ગોઠવાય છે.
  • Hierarchical: એક tree, દરેક child નો બરાબર એક parent; કડક, many-to-many માં નબળું.
  • Network: એક graph, એક child ના ઘણા parents હોઈ શકે; લવચીક પણ navigate કરવામાં જટિલ.
  • E/R: એક design/conceptual diagram, બનાવતાં પહેલાં plan કરવા, store માટે નહીં.
  • Relational: keys થી જોડાયેલી સરળ TABLES (Codd); simplicity, SQL, flexibility, theory ને કારણે પ્રમુખ.
  • યાદ રાખવાની યુક્તિ: family tree સામે web સામે blueprint સામે card-catalogue tables, tables જીતી.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Concepts of Database

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Database Models (Hierarchical, Network, E/R, Relational) · Data Processing and Analysis (DPA) · Gri-Learn