Database Reference
In-Depth Information
In the above code, WHERE speciies the value to be updated. Without the WHERE
clause, all the values in the same column will be updated. he SET keyword is used to set a
new value.
4.5.3 Querying Data
he following example shows how to query the information about the employees with the last
name Smith:
SELECT FirstName, LastName
FROM EMPLOYEE
WHERE LastName = 'Smith'
4.5.4 Deleting Data
In the following example, you will delete the row where the employee's last name is Chen:
DELETE FROM EMPLOYEE
WHERE LastName = 'Chen'
Again, the WHERE clause is necessary to specify which row to be deleted. Otherwise, all rows
will be deleted.
ACTIVITY 4.3 POPULATING DATABASE TABLES WITH DATA
After the tables are created, it is time to populate the tables with data. In this section, we
will insert data into the tables in the database Computer_Store as well as the tables in the
database Class_Registration.
When entering data into the tables, you should irst enter the data into the tables with-
out foreign key columns. After the data are entered into the tables without foreign keys, you
can populate the tables with foreign key columns. In such a way, the data values entered
into foreign key columns can be veriied by the foreign key constraint to see if there is a
match with the primary keys in the parent tables. If there is no match, you will get an error
message.
TASK 1: POPULATE COMPUTER_STORE DATABASE
Follow the steps below to populate the Computer_Store database with SQL statements in
Windows Azure SQL Database:
1. Assume that you have logged on to the Windows Azure Management Portal. Select
SQL DATABASES and the database Computer_Store . Click MANAGE to log on
to the SQL Database portal shown in Figure 4.14.
2. Once the SQL Database portal is opened, click New Query . Enter the following SQL
statements in the New Query pane. hen, click Run .
 
Search WWH ::




Custom Search