DEV Community

Lavinya Correia
Lavinya Correia

Posted on • Updated on

First steps with SQL

Hey, guys! I’m here to do a synthesis of contents all over the basics topics about working with data. I decided to write this post because what I’ve been studying is spread on different websites and I thought it would be easier to see an overview at once. So, grab a coffee and let’s go!
Alt text of image
What is a database?
A database is responsible for organize the data, which facilitates the search for a specific data in a large table. The most used are organized in tables, like in a spreadsheet that you do about your finance, separated by types of expenses, savings and so on.
They are tabulated in columns and rows, that's called relational database. The columns are composed of properties about the item, for example the item PERSON could contain LAST NAME, FIRST NAME, TELEPHONE NUMBER, EMAIL.

Now you’re able to describe a database, try to answer “what is a database?” without looking at the notes. Could you do it?

Alt text of image

DBMS / RDBMS
You gotta think about a program that stores data and also provides the service for adding, modifying and querying that data. Database Management System, or DBMS if you prefer, is a set of software tools for the data, basically is a group of programs which manipulate the database. For relational databases, it's called a Relational Database Management System, or RDBMS. An RDBMS serves as the backbone of applications in many industries including banking, transportation, and so on. Examples of relational database management systems are: MySQL, Oracle Database, and DB2 Express-C.
The DBMS offers advantages such as techniques to store and retrieve data; application programmers never exposed to details of data representation; Data Integrity and Security; integrity constraints to a high level of protection.
So, it 's perfect? Unfortunately no, some disadvantages are: cost of Hardware and Software; they are complex and required training; if the data is into a single database, can be damaged because of electrical failure or corrupted on the storage media; DBMS can’t perform sophisticated calculations.

Now you can describe DBMS, answer “what is DBMS?” without looking at the notes. If you’re having trouble, try to read again before continuing.

INFORMATION AND DATA MODELS
An Information Model is an abstract representation of entities that embraces their properties, operations and relationships that can be executed on them. Information Model is at the conceptual level, it defines relationships between objects, there are several types of Information Models, the most popular is the Hierarchical, typically used to show organization charts. In other way, Data Models are concrete and specific/include details, most data models embody those basic operations:

  • The data contained in the database (e.g., entities: analyst, product owner, subjects, courses)
  • The relationship between data items (e.g., analyst are supervised by product owner)
  • The constraints on data (e.g., analyst id has exactly six digits)

Entities (real-world object that exists) have attributes, which are the data elements that characterize the entity. Attributes tell us more about the entity.

This turn, I have 2 questions for you. Tell me, “what’s the difference between information model e data model?” and “What’s an entity and attribute?”, without looking at the notes.

E-R Models and Relational Model
The Relational Model is the most used data model for databases because this model allows for data independence. Data is stored in a simple data structure: tables. It’s about the collection of Tables and their relation.
Entity-Relationship Diagram, or ERD, that represents entities and their relationships. We have authors who write books, borrowers who take books out on loan, various copies of each book. It’s about the collection of objects (entities) and their relation. In an E-R Diagram, an entity is drawn as a rectangle, and attributes are drawn as ovals. Entities can be a noun (person, place, or thing).
The main difference E-R Model is entity specific, and Relational Model is table specific.

Alt Text

Now you can describe E-R Models and Relational Model, answer “what is the difference between them?” without looking at the notes.

...

Lavinya Correia, March 27th, 2021
LinkedIn: https://www.linkedin.com/in/lavinyacorreiadev/

I recommend you to read the references’ websites to go deeper.
Thanks, bye bye

References

https://techdifferences.com/difference-between-e-r-and-relational-model-in-dbms.html
https://opentextbc.ca/dbdesign01/chapter/chapter-5-data-modelling/

Top comments (0)