2.5

Table Of Contents
Example: Create a Check Constraint
A check constraint evaluates to a Boolean value. Use Check constraints to determine whether a value entered
for a column meets a specific truth-type requirement. For example, suppose that you create a column that must
be a positive integer, such as a product price. You can create a Check constraint to return TRUE when the product
price is greater than 0, and to return FALSE when the product price is less than 0. The Check constraint ensures
that if a user tries to enter a negative product price, the data entry operation fails with a SQL error.
1 Click a table to select it.
2 Click the gear icon, and select Create > Constraint.
3 Select Check Constraint.
1 Type a name for the constraint, such as check_positive_price.
2 Enter the constraint in the Check text box.
3 (Optional) Enter a comment that describes the constraint.
4 Click OK.
Data Director creates the constraint.
SQL Management
Managing SQL includes developing and testing SQL queries and monitoring and tuning query performance.
You must have appropriate permissions on the schema and database to develop and manage SQL queries. You
can manage SQL from the schema page.
Enter and Run a SQL Query
Create and modify SQL queries.
Prerequisites
You are logged in to Data Director as a user with appropriate privileges on the database or schema.
Procedure
1 Click the Manage and Monitor tab.
2 Right-click a database and select Open vPostgres Console.
3 Click Enter SQL.
4 Enter a query in the Entry pane.
You can type or modify a SQL query, test the query, and analyze the query's execution plan before running
it.
n
Type the query in the entry pane.
n
Click Open to open a SQL script file.
5 Click Execute to run the query.
If the query runs successfully, data appears in the Output pane.
VMware vFabric Data Director Administrator and User Guide
126 VMware, Inc.