Structured Query Language (SQL)

37 flashcardspar —Griffith—
Réviser ces flashcardsGratuit · répétition espacée · iPhone, Android, Mac et web

Toutes les cartes

1
What is SQL and how easy is it to learn?
SQL is a nonprocedural language with a vocabulary of less than 100 words, making it relatively easy to learn.
2
What are the two broad categories of SQL functions?
Data Definition Language (DDL) and Data Manipulation Language (DML).
3
What is the purpose of DDL in SQL?
DDL includes commands to create database objects (tables, indexes, views) and define access rights to those objects.
4
What is the purpose of DML in SQL?
DML includes commands to insert, update, delete, and retrieve data within database tables.
5
What does the SQL CREATE command do?
It is used to create table structures.
6
What does the SQL ALTER command do?
It is used to make changes in table structures, including adding, modifying, or dropping columns.
7
What is the syntax to add a column using ALTER TABLE?
ALTER TABLE tablename ADD columnname;
8
How do you modify a column using ALTER TABLE?
ALTER TABLE tablename MODIFY columnname datatype;
9
How do you delete a column using ALTER TABLE?
ALTER TABLE tablename DROP columnname;
10
How do you define a primary key using ALTER TABLE?
ALTER TABLE tablename ADD PRIMARY KEY(fieldname);
11
How do you define a foreign key using ALTER TABLE?
Use FOREIGN KEY instead of PRIMARY KEY in the ALTER TABLE statement.
12
What does the DROP TABLE command do?
It deletes a table from the database.
13
What is a SQL view?
A virtual table created based on a SELECT query using CREATE VIEW.
14
What is the purpose of the NOT NULL constraint?
It ensures that a column does not accept null values, required for Primary Keys.
15
What is the purpose of the UNIQUE constraint?
It ensures all values in a column are unique, required for Primary Keys.
16
What does the DEFAULT constraint do?
It assigns a value to an attribute when a new row is added.
17
What does the CHECK constraint do?
It validates data when an attribute value is entered.
18
What is the purpose of the INSERT command in SQL?
To enter data into a table.
19
What is the syntax for inserting a single row?
INSERT INTO columnname VALUES (value1, value2, ..., valuen);
20
What is the syntax for inserting multiple rows using a subquery?
INSERT INTO tablename SELECT columnlist FROM tablename;
21
What is the purpose of the SELECT command?
To retrieve and list the contents of a table.
22
How do you select all columns in a table?
Use the asterisk (*) wildcard in SELECT, e.g., SELECT * FROM tablename;
23
How do you add conditional restrictions to a SELECT query?
By using the WHERE clause: SELECT columnlist FROM tablelist WHERE conditionlist;
24
What is the purpose of the UPDATE command?
To modify existing data in a table.
25
What is the syntax for the UPDATE command?
UPDATE tablename SET columnname = expression [, columnname = expression] [WHERE conditionlist];
26
What does the DELETE command do?
Deletes one or more rows from a table.
27
What happens if you omit the WHERE clause in a DELETE statement?
All rows in the table are deleted.
28
What is the purpose of the COMMIT command?
To permanently save any changes made to the database.
29
What is the purpose of the ROLLBACK command?
To restore the database to its previous state, only if COMMIT has not been used.
30
How do you sort query results in SQL?
Using the ORDER BY clause in a SELECT statement, in ascending or descending order.
31
What are aggregate functions in SQL?
Functions that perform arithmetic computations over a set of rows, e.g., COUNT, MIN, MAX, AVERAGE.
32
What is the purpose of the GROUP BY clause?
To group data in queries for aggregation or to limit results to unique entries.
33
Why are joins important in relational databases?
They allow combining data from more than one table based on common attributes.
34
What is a natural join?
A join that matches only rows with equal values in specified columns.
35
What is an alias in SQL?
An alternate name for a table used in the FROM clause, e.g., FROM tablename alias.
36
Name the main types of SQL joins.
Inner Join, Left Join (Left Outer Join), Right Join (Right Outer Join), Full Join.
37
What is a recursive join?
A join where a table is joined to itself.
Réviser les 37 cartes gratuitement

Plus de flashcards : Informatique

algorithms code17 cartesInformatique · AnglaisSabs2023Intro to Scratch Study Guide12 cartesInformatique · AnglaisSgComptia A+ 1101204 cartesInformatique · Anglaisun étudiant OutLearnCybersecurity and Social Engineering126 cartesInformatique · AnglaisAbelComputer Hardware and Peripherals89 cartesInformatique · AnglaisPERAS,Cybersecurity Exam 171 cartesInformatique · AnglaisZackJLinux 2344 Final60 cartesInformatique · AnglaisCarterHardware48 cartesInformatique · AnglaisJASMINCS 320 L1 - L341 cartesInformatique · AnglaisElijahmemory36 cartesInformatique · AnglaisAshleyCMSC13130 cartesInformatique · AnglaistdmillingtonWeek 7 - Computer Buses and Pipelining23 cartesInformatique · Anglais—Griffith—

Tous les decks : Informatique

Révise ces decks dans l’app

Gratuit sur iPhone, Android, Mac et le web. Ajoute n’importe quel deck à ton compte en un tap.

Télécharger dans l’App StoreDisponible sur Google Play
Réviser les 37 cartes gratuitement