Chapter 6 and 7: SQL Commands and Data Defintion

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:01 PM on 11/27/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

23 Terms

1
New cards

The SQL command used to filter rows based on a specified condition is __________.

WHERE

2
New cards

The __________ clause in SQL is used to specify groups of rows that have the same column value.

GROUP BY

3
New cards

To specify the order of the output in SQL, you use the __________ clause.

ORDER BY

4
New cards

The SQL term for removing duplicate rows from the result set is __________.

DISTINCT

5
New cards

To create a new database, the SQL command used is __________.

CREATE DATABASE database_name;

6
New cards

To identify multiple values in a WHERE clause, you use __________.

IN

7
New cards

The SQL command used to update existing data in a database is __________.

UPDATE table_name

SET column_name = new_value

WHERE condition;

8
New cards

The SQL command to delete a specific row from a table is __________.

DELETE FROM Viewing

WHERE propertyNo = 'PG4'

9
New cards

In SQL, __________ is used to remove all rows from a table without the possibility of a rollback.

DELETE FROM table_name

10
New cards

To add a new column in an existing table, you would use the __________ command.

ALTER TABLE table_name

ADD column_name datatype;

11
New cards

To remove a column from a table, you use __________ command.

ALTER TABLE table_name

DROP COLUMN column_name;

12
New cards

The __________ function can be used for both numeric and non-numeric data types.

COUNT, MIN, and MAX.

13
New cards

The SQL keyword that allows you to assign a name to a calculated field is __________.

AS.

14
New cards

To drop an entire table from the database, you would use the __________ command.

DROP TABLE table_name;;

15
New cards

To retrieve the total count of rows from a dataset, you use the __________ function.

COUNT.

16
New cards

How to create a table in SQL

CREATE TABLE Persons (
    column1 datatype,
column2 datatype,

….

PRIMARY KEY (column)
);

17
New cards

Syntax for adding a foreign key in SQL is __________.

ALTER TABLE table_name

ADD CONSTRAINT fk_name

FOREIGN KEY (column_name) REFERENCES other_table (other_column);

18
New cards

How to create a schema in SQL?

CREATE SCHEMA schema_name;

19
New cards

Syntax for Natural Join

SELECT *

FROM table1

NATURAL JOIN table2;

20
New cards

Syntax for Cross Join

SELECT *

FROM table1

CROSS JOIN table2;

21
New cards

Domain Constraints

Constrains the values of a single coumn

22
New cards

Entity Integrity

The primary key of a table must contain a unique, nonnull value of each row

23
New cards

Referential Integrity

If the foreign key contains a value, that value must refer to an existing, valid row in the parent table