Database (Base de données) and SQL

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

In database design, what distinguishes a foreign key from other types of keys?

  • It automatically generates unique values for each record.
  • It references a primary key in another table, establishing a link between the two. (correct)
  • It is always a numeric data type for optimal indexing.
  • It uniquely identifies each record in a table.

What is the fundamental purpose of a primary key in a SQL database table?

  • To ensure each row in the table has a unique identifier. (correct)
  • To optimize query performance by creating indexes.
  • To enforce data type constraints across multiple columns.
  • To define the relationship between different tables in the database.

What scenario primarily necessitates the use of an intermediary table in database design?

  • When implementing a many-to-many relationship between two entities. (correct)
  • When implementing inheritance between two entity types.
  • When needing to store calculated fields derived from other tables.
  • When direct relationships between tables aren't possible

Which of the following accurately describes the role of the 'Conceptual Data Model (MCD)' within the MERISE database design method?

<p>It outlines the relationships between entities without detailing implementation. (A)</p> Signup and view all the answers

What is the core function of a 'JOIN' operation in SQL?

<p>To combine rows from two or more tables based on a related column. (A)</p> Signup and view all the answers

Consider a scenario where you need to retrieve only the unique values from a 'product_category' column in a 'products' table. Which SQL statement would achieve this?

<p><code>SELECT DISTINCT product_category FROM products</code> (B)</p> Signup and view all the answers

How does implementing a subquery impact query execution and design in SQL?

<p>It embeds a query within another query, allowing for complex conditional selection. (D)</p> Signup and view all the answers

In the context of GDPR, what does the 'right to data portability' empower individuals to do?

<p>Receive their personal data in a commonly used format and transmit it to another controller. (B)</p> Signup and view all the answers

Under GDPR, what best describes the responsibilities of a 'data controller'?

<p>An entity that determines the purposes and means of processing personal data. (D)</p> Signup and view all the answers

In RESTful API design, which HTTP method is typically used to retrieve a specific resource?

<p>GET (D)</p> Signup and view all the answers

Flashcards

What is a foreign key?

A column whose values reference a primary key in another table.

What is a primary key in SQL?

A column or set of columns with unique values for each row in a table.

What is a join in SQL?

Combines rows from two tables based on a common condition.

What are the different types of joins in SQL?

INNER, LEFT, RIGHT, FULL OUTER, CROSS.

Signup and view all the flashcards

How to select distinct values?

SELECT DISTINCT column FROM table;

Signup and view all the flashcards

What is a subquery in SQL?

A query nested inside another query.

Signup and view all the flashcards

How to calculate the sum of column values?

SELECT SUM(column) FROM table;

Signup and view all the flashcards

How to get the number of rows?

SELECT COUNT(*) FROM table;

Signup and view all the flashcards

What is GDPR?

A European Union regulation to protect individuals' personal data.

Signup and view all the flashcards

What is an API?

An interface that allows two applications to communicate.

Signup and view all the flashcards

Study Notes

Base de données (Database)

  • A foreign key is a column whose values reference a primary key in another table.
  • A primary key in SQL is a column or set of columns with unique values for each row in a table.
  • An intermediary table results from a Many-To-Many association between two entities, linking two tables.
  • Data model design models used in MERISE include:
    • Conceptual Data Model (MCD)
    • Logical Data Model (MLD)
    • Physical Data Model (MPD)

SQL

  • A SQL join combines rows from two tables based on a common condition.
  • SQL join types:
    • INNER JOIN
    • LEFT JOIN
    • RIGHT JOIN
    • FULL OUTER JOIN
    • CROSS JOIN
  • To select distinct values from a column: SELECT DISTINCT column FROM table;
  • A subquery in SQL is nested within another query.
  • To calculate the sum of a column's values: SELECT SUM(column) FROM table;
  • To get the number of rows in a table: SELECT COUNT(*) FROM table;
  • To check for NULL values in a column: SELECT * FROM table WHERE column IS NULL
  • To select rows from a table where a column's value exceeds 100: SELECT * FROM table WHERE column > 100;
  • To limit the number of results returned by a SQL query to 10: SELECT * FROM table LIMIT 10;

RGPD (GDPR)

  • GDPR (General Data Protection Regulation) is EU regulation designed to protect individuals' personal data and strengthen privacy and security rights.
  • GDPR's main objectives:
    • Protect individual's personal data
    • Harmonize data protection regulations across the EU.
  • Data portability under GDPR allows individuals to receive their personal data in a structured, commonly used, machine-readable format and transmit it to another data controller.
  • Key roles defined by GDPR:
    • Data controller
    • Data processor
    • Data Protection Officer (DPO).

API

  • A REST API (Representational State Transfer) uses HTTP verbs and specific conventions for operations.
  • An API enables communication between two applications; for example, using the Google Maps API to integrate maps into an application.
  • To make a GET request with a REST API in Python:
    import requests
    url = 'https://api.example.com/resource' 
    response = requests.get(url)
    

JSON/API

  • A JSON (JavaScript Object Notation) response is a lightweight, human-readable data format.

JSON/Python

  • To extract data from a JSON response in Python:
    import requests
    url = 'https://api.example.com/resource'
    response = requests.get(url)
    data = response.json()
    

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser