16.10.2015 Views

Getting Started with IBM Data Studio for DB2

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

86 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>IBM</strong> <strong>Data</strong> <strong>Studio</strong> <strong>for</strong> <strong>DB2</strong><br />

2.4.4 Creating views<br />

Views provide another way of representing the data that exists in the tables of a database.<br />

Views don’t contain the data, but they allow you to writeSELECT andJOIN statements to<br />

represent data stored in tables <strong>with</strong>out exposing the details of how the data is actually<br />

structured. You can use a view to select an entire table, join together multiple tables, or<br />

omit specific columns as a way to restrict access to the data.<br />

To create a view of columns in a single table or in multiple tables:<br />

1. Right-click the Views folder in the Administration Explorer and select Create View. You<br />

must select the schema in which to create the view. SelectMYSCHEMA and click OK.<br />

The Properties view will display the attributes of the new view, as shown in Figure 2.19.<br />

2.19 – Defining a new view<br />

2. In the General tab, specify the name of the view,MYVIEW.<br />

3. In the SQL tab, define the columns <strong>for</strong> this view, using an SQL query. Type the<br />

following query in the Expression field to select theEMP_ID andADDRESS columns<br />

fromMYTABLE:<br />

SELECT "EMP_ID", "ADDRESS" FROM "MYSCHEMA"."MYTABLE"<br />

4. Click Update to update your view definition.<br />

In the planned changes bar of the object list editor, you see the count of new and changed<br />

objects updated to include the new view. In the next section, you will deploy the new view<br />

to the database, along <strong>with</strong> the other objects in the change plan.<br />

2.4.5 Deploying multiple changes <strong>with</strong> a change plan<br />

In the previous sections, you created a set of changes to a database in a change plan. A<br />

change plan groups multiple related changes together and allows you to deploy them in a<br />

single step. This section will show you how to deploy the changes to the database.<br />

To deploy the change plan to the database:<br />

1. In the object list editor, review the number of new and changed objects by clicking the<br />

delta icon. Then, click the Review and Deploy Changes button, shown in Figure 2.20.<br />

<strong>Data</strong> <strong>Studio</strong> opens the Review and Deploy window, <strong>with</strong> a preview of the commands<br />

that will be used to deploy the changes to the database.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!