Download 2. Creating a database Designing the database schema

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Concurrency control wikipedia , lookup

IMDb wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

SQL wikipedia , lookup

Ingres (database) wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

PL/SQL wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
COMU114/M1G505190: Introduction to Database Development
Altering a table
Sometimes you need to change the design of a table after it has been created, or even
after it has data in it. You can do this in table design view, or in SQL. The following SQL
adds a new field to the Users table. Existing rows will simply have a NULL value in that
field.
ALTER TABLE Users ADD email Text(25) The next example adds a primary key, which could be useful if we forgot to define it
when the table was created:
ALTER TABLE Users ADD PRIMARY KEY(username) Finally, this example drops, or deletes, a field from the table:
ALTER TABLE Users DROP COLUMN datejoined Dropping fields can be dangerous as the data in that field of every row will be deleted.
Some RDBMSs don’t allow alterations which may lead to loss of data – Access seems
quite happy to drop fields without warning you of the consequences!
page 22