Module 2: DDL

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the correct form for creating a new table? A) create table employees B) create employees

a

What command would you use to change the structure of the existing database?

alter

Write a line of code that will alter a table named customers and create a column named code with an integer data type and the column is a primary key (no capitals or semicolon needed)

alter table customers add code int primary key

Write a code block that will create a column named email with datatype varchar (30) to table called customers on a single line (no capitals or semicolon needed)

alter table customers add email varchar (30)

Write a code block that will remove a column called name from a table called customers (no capitals or semicolon needed)

alter table customers drop column name

Write a line of code that will alter a table named orders and add a foreign key to a column named personid and will reference another table named persons and its column named personid (no capitals or semicolon needed )

alter table orders add foreign key (personid) references persons (personid)

Write a line of code that will alter a table named product and add a column named amount with a decimal data type with D = 3 and P=5 and this column cannot be null (no capitals or semicolon needed )

alter table product add amount decimal (5,3) not null

Write a single line of code that will change the date type of a column named description to text to a table called products and does not allow null values

alter table products modify description text not null

Which option is the correct form to make a column a primary key when altering a table?

b

What command would you use to build a database and its objects like (table, index, views, store procedure, function, and triggers)

create

What are the 3 commands used in DDL? (HINT: C A D)

create alter drop

CREATE ALTER DROP are part of what language?

data definition language

What does DDL stand for?

data definition language

Which language deals with database schemas and descriptions of how the data should reside in the database? (type the full language name)

data definition language

What command would you use to delete objects from the database

drop

Write a line of code that will remove a database called customers (no capitals or semicolon)

drop database customers

Write a line of code that will drop a schema named hr (no capitals or semicolon needed)

drop schema hr

Write a code block that will remove a table called customers (no capitals or semicolon needed)

drop table customers

The DROP TABLE statement removes a table but not its data.

false

add column employees and add employees are different

false

alter employees is the correct form if you want to modify the table

false

What is the keyword that allows you to change the data type of a column within a table?

modify

Tables, indexes, views, store procedures, functions, and triggers are referred to as?

objects

In MySQL, the schema is the synonym for the database, therefore, you can use them interchangeably

true

alter table employees is the correct form if you want to modify the table

true

drop column employees and drop employees are valid

true


Conjuntos de estudio relacionados

Enrolled Agent Forms- Representation

View Set

ch 24 parathyroid/ adrenal disorders patho davis

View Set

Video 1: Beliefs That Make You Fail...or Succeed

View Set

Simplified Acquisition Procedures

View Set

Consumer Math - Sequences, The Rule of 78

View Set

Chapter 1: What is Science? Vocabulary

View Set

CS-4451 Quiz 13 - Incident Preparation Response and Investigation Study Questions

View Set

Chapter 14 Firms in competitive markets

View Set

NU Exam 5 Nutrition, Sensation, Perception and Response, Urinary Elimination

View Set