Chapter 5_Database Query Languages

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

50 Terms

1
New cards

Query language

is a specialized computer language used to make queries and retrieve information from databases.

2
New cards

Query language

It serves as an interface between users and databases, enabling users to manage data from a database management system (DBMS).

3
New cards

Structured Query Language (SQL),

  • One of the most widely used modern query languages is ___

  • a domain-specific programming language used to interact with relational databases and perform operations on structured data within.

4
New cards

"FIND," "INSERT," "DELETE," "ORDER BY," "SUM," and "SELECT,"

schema, searching, populating, updating

Structured query languages make use of commands like "___," "___," "___," "___," "___," and "___," which can be formed into syntactical statements for operations including defining and changing database ___, ___, ___, and ___ the contents of a database, and defining everything from triggers and integrity constraints to stored procedures and authorization rules.

5
New cards

query

  • In the broadest sense, a ___ refers to a request for data or information from a database or a data repository system.

  • This request is typically made in the form of a specific question or command, written in a query language that the database understands.

6
New cards

query

A ___can be as simple as fetching a specific subset of data from a particular table or as complex as performing intricate calculations and data transformations.

7
New cards

find,

summarize,

filter,

combine,

adjust,

delete,

insert,

update

(FSFCADIU)

Queries can be used to ___, ___, ___, ___, ___, ___, ___, and ___ data. They can also answer data-related questions, analyze data from multiple tables at once, and automate data management tasks.

8
New cards

select queries,

parameter queries,

make-table queries,

append queries,

crosstab queries

Some basic types of queries include ___, ___, ___, ___, and ___, but with the structured commands enabled by query languages, queries can also grow exponentially elaborate.

9
New cards

procedural

declarative

Primary types of query languages:

Query languages are integral in database management, serving as mediums to retrieve and manipulate data.

Broadly categorized, they fall into two buckets: 

10
New cards

Procedural languages

__ instruct a computer on how to execute tasks, and the focus is on defining step-by-step procedures.

11
New cards

src

Procedural languages require a specific exact ___ to the data, accounting for every step taken to fetch and construct the desired output.

12
New cards

Declarative query languages

___ abstract the 'how-to,' focusing on the 'what' — defining only the desired outcome without dictating the retrieval method. They are more aligned with traditional database queries and allow for easier manipulation of data structures, increasing productivity.

13
New cards

SQL, 

PL/SQL

Declarative query examples include the widely used ___, while procedural paradigms are exemplified by languages like ___.

14
New cards

relational databases,

declarative language

SQL is by far the most popular and commonly used query language for ___.

It is known as a ___, meaning it describes what needs to be accomplished rather than how to accomplish it, but it also includes traditionally procedural elements.

15
New cards
  • Data Query Language (DQL)

  • Data Definition Language (DDL)

  • Data Control Language (DCL)

  • Data Manipulation Language (DML)

  • Transaction Control Language (TCL)

SQL sub-languages are commonly divided into five main categories: (5)

16
New cards

Data Query Language (DQL)

is used to query or retrieve data from the database. It typically involves using the SELECT statement.

Example

SELECT * FROM employees WHERE department = 'IT';

17
New cards

Data Definition Language (DDL)

is used to define and modify the structure of database objects such as tables, indexes, and schemas.

18
New cards

Data Definition Language (DDL)

Examples: Creating Table

CREATE TABLE employees (

id INT PRIMARY KEY,

name VARCHAR(100),

department VARCHAR(50)

);

19
New cards

Data Definition Language (DDL)

Examples: After Table

ALTER TABLE employees ADD COLUMN salary DECIMAL(10, 2);

Examples: Drop Table

DROP TABLE employees;

20
New cards

Data Control Language (DCL)

is used to control access to the data in the database, dealing with permissions and user rights.

Examples: Grant Permission

GRANT SELECT ON employees TO user_name;

Examples: Revoke Permission

REVOKE INSERT ON employees FROM user_name;

21
New cards

Data Manipulation Language (DML)

is used to manipulate data within the tables, allowing for insertion, updates, deletion, and retrieval.

22
New cards

Data Manipulation Language (DML)

Example: Insert

INSERT INTO employees (id, name, department) VALUES (1, 'John Doe', 'IT’);

Example: Update

UPDATE employees SET department = 'HR' WHERE id = 1;

Example: Delete

DELETE FROM employees WHERE id = 1;

23
New cards

Transaction Control Language (TCL)

is used to manage transactions within a database, ensuring the integrity and consistency of data.

24
New cards

Transaction Control Language (TCL)

Example: Commit Transaction

COMMIT;

Example: Rollback Transaction

ROLLBACK;

Example: Save Transaction Point

SAVEPOINT savepoint_name;

25
New cards

NoSQL,

Not Only SQL

there are languages for non-relational databases called ___, or "___" databases.

26
New cards

key values,

graphs,

wide columns,

documents

Unlike relational databases that use tables and structured data, NoSQL databases use methods like ___, ___, ___, and ___ to store and retrieve data.

27
New cards

dynamic schemas

While SQL is suited for relational databases housing structured data and using predefined schemas, NoSQL excels with ___ for unstructured data and big data.

28
New cards

serve different purposes

Query languages and programming languages ______.

While both are critical in the realm of computing, each has a distinct role in interaction with data and systems:

29
New cards

build

Programming languages like Python or Java are designed to ___ software applications, handling everything from algorithmic processing to data manipulation and user interface design.

30
New cards

interacting

Query languages, on the other hand, are specialized for ___ with databases.

31
New cards

Query languages

__ exist within a subset of computer languages — solely focused on data retrieval and management. This specialization allows users to extract, update, and manipulate data within a database without affecting the underlying software logic.

32
New cards

Query commands

__ are concise and highly focused, simplifying complex data operations into readable statements. This is a major difference from programming languages, which often require multiple lines of code to perform similar database operations.

33
New cards

GraphQL

allows clients to request specific data, reducing over-fetching and under-fetching.

Example:

{

user(id: "123") {

name

email

posts {

title

content

}

}

}

34
New cards

SPARQL

is used to query RDF data on the Semantic Web

Example:

SELECT ?person ?email

WHERE {

?person rdf:type ex:Employee .

?person ex:email ?email .

}

35
New cards

SQL

is used to manage relational databases, with operations like SELECT, INSERT, UPDATE, and DELETE.

Example:

SELECT name, email

FROM employees

WHERE department = 'IT’;

36
New cards

Oracle PL/SQL

is Oracle’s procedural extension to SQL, allowing for more complex operations.

Example:

BEGIN

FOR emp IN (SELECT id, salary FROM employees WHERE department = 'HR') LOOP

emp.salary := emp.salary * 1.10;

UPDATE employees SET salary = emp.salary WHERE id = emp.id;

END LOOP;

COMMIT;

END;

37
New cards

Prisma

is a database toolkit that offers type-safe query building for modern databases.

Example (JavaScript Prisma Query):

const employees = await prisma.employee.findMany({

where: { department: 'IT' },

select: { name: true, email: true },

});

38
New cards

MongoDB

NoSQL databases use flexible schemas; ___ is a popular example that uses a JSON-like query language.

Example:

db.employees.find({ department: 'IT' }, { name: 1, email: 1 });

39
New cards
  • Extracting relevant data

  • Filtering unnecessary data

Query languages are vital in managing databases, and with their diverse features, they empower users to fulfill multiple data manipulation use cases. Some common scenarios include: (2)

40
New cards

Extracting relevant data

Use query languages to retrieve specific data from a large database quickly, avoiding manual extraction.

41
New cards

Filtering unnecessary data

With declarative query languages like SQL's SELECT statement, filter out unnecessary data and provide a more efficient way to interact with databases.

42
New cards

sorting

Query languages like SPARQL enable the ___ of retrieved data by specific fields, making it easier to visualize and analyze results.

43
New cards

Updating existing data

Use UPDATE in SQL or equivalent commands in other query languages to alter existing data within databases without having to manually modify each record.

44
New cards

Aggregating data

Query languages often incorporate aggregation functions like SUM, COUNT, AVERAGE, and MAX to summarize and analyze data within databases.

45
New cards

Managing data integrity

With ACID properties in SQL or similar capabilities in other query languages, ensure the integrity of database transactions.

46
New cards

Web development

Query languages like SQL and MongoDB's MQL are integral in web development, enabling seamless data access for applications.

47
New cards

Business Intelligence (BI)

BI tools allow users to query databases directly using familiar declarative query language commands to analyze trends or insights from large datasets.

48
New cards

Data warehousing

Efficiently manage and transform huge amounts of data with the help of query languages, enabling data warehousing and business intelligence solutions.

49
New cards

Database administration

Query languages empower database administrators with the tools necessary to manage, maintain, and optimize databases for different use cases within an organization

50
New cards

GraphQL

SPARQL

SQL

Oracle PL/SQL

Prisma

NoSQL

Common Query Languages (GSSOPN)