Professional Documents
Culture Documents
University Of Grarmian
IT Department
Stage 2
Let’s say that you want to order an Americano at a coffee shop. You
make a request by saying, “Can I have an Americano?”. The barista
will understand the meaning of your request and give you the
ordered item.
A query works the same way – it adds meaning to the code,
allowing the system to understand and execute actions accordingly.
Be it SQL or any other query language, both the user and the
database can exchange information as long as they use the same
language.
Meanwhile, a well-designed database stores data in multiple tables.
They consist of columns that hold the data’s attributes, along with
rows or records of information. A query then helps retrieve data
from different tables, arrange them, and display them according to
the commands.
A query can either be a select, an action, or a combination of both.
Select queries can retrieve information from data sources, and
action queries work for data manipulation, for example, to add,
change or delete data.
Advanced users can also use query commands to perform various
programming tasks, from creating MySQL users and granting
permissions to changing WordPress URLs in MySQL databases.
Below are some of the most common query commands along with
their functions:
SELECT – fetch data from the database. It’s one of the most
popular commands, as every request begins with a select
query.
QUERY LANGUAGES
As mentioned before, choosing the database and its language is
crucial when working with queries. In addition to SQL, there is
another type of database called NoSQL (Not Only Structured Query
Language). The main difference between the two is the data
structure.
SQL databases are relational and use predefined schemas that
require you to specify your data structure. On the other hand,
NoSQL databases are non-relational and have dynamic schemas
for unstructured data.
Regardless, both SQL and NoSQL provide applicable options. An
SQL database is a great choice for an ACID-compliant data
structure. Conversely, if you have unstructured documents, key-
values, or graphs, a NoSQL database might be an ideal choice.
QUERY EXAMPLES
Before we delve into the examples, below are the main benefits of
using a query:
Now, let’s suppose you have collected some data from a survey.
Below is a snippet of your data. Note that for this example, we will
use an SQL database.
Data source: Participant (Table Name)
WHAT IS A QUERY?
DATABASE QUERY
EXPLAINED
WHAT IS A QUERY?
A database query is a request for data from a database. The
request should come in a database table or a combination of tables
using a code known as the query language. This way, the system
can understand and process the query accordingly.
HOW DOES QUERY WORK?
Let’s say that you want to order an Americano at a coffee shop. You
make a request by saying, “Can I have an Americano?”. The barista
will understand the meaning of your request and give you the
ordered item.
A query works the same way – it adds meaning to the code,
allowing the system to understand and execute actions accordingly.
Be it SQL or any other query language, both the user and the
database can exchange information as long as they use the same
language.
Meanwhile, a well-designed database stores data in multiple tables.
They consist of columns that hold the data’s attributes, along with
rows or records of information. A query then helps retrieve data
from different tables, arrange them, and display them according to
the commands.
A query can either be a select, an action, or a combination of both.
Select queries can retrieve information from data sources, and
action queries work for data manipulation, for example, to add,
change or delete data.
Advanced users can also use query commands to perform various
programming tasks, from creating MySQL users and granting
permissions to changing WordPress URLs in MySQL databases.
Below are some of the most common query commands along with
their functions:
SELECT – fetch data from the database. It’s one of the most
popular commands, as every request begins with a select
query.
QUERY LANGUAGES
As mentioned before, choosing the database and its language is
crucial when working with queries. In addition to SQL, there is
another type of database called NoSQL (Not Only Structured Query
Language). The main difference between the two is the data
structure.
SQL databases are relational and use predefined schemas that
require you to specify your data structure. On the other hand,
NoSQL databases are non-relational and have dynamic schemas
for unstructured data.
Regardless, both SQL and NoSQL provide applicable options. An
SQL database is a great choice for an ACID-compliant data
structure. Conversely, if you have unstructured documents, key-
values, or graphs, a NoSQL database might be an ideal choice.
QUERY EXAMPLES
Before we delve into the examples, below are the main benefits of
using a query:
Now, let’s suppose you have collected some data from a survey.
Below is a snippet of your data. Note that for this example, we will
use an SQL database.
Data source: Participant (Table Name)
ID Name Sex Age Occupation
The statement above filters specific data from the table. It will
generate the following result table:
Name Occupation
John Student
Peter Unemployed
Margareth Teacher
Lea Unemployed
-REFERENCE: