SQL serever Learning 6--Data Sheet 2

Source: Internet
Author: User

Modifying the properties of a data table

When you save the changes to the data table, you always get a warning that prevents changes.

There are 2 ways to solve this problem:

1. You can use T-SQL statements to forcibly modify

2. Tools Option Designer Table Designer and Database Designer block save requirements Check out

Set foreign keys

A table with a foreign key is called a foreign key table, where the "type" of the commodity table is a foreign key, so the commodity table is the outer table, which is associated with the "type number" of the type table.

Commodity table Design View

Type table Design view

Set the FOREIGN KEY constraint for the Type field of the commodity table, right-type field, select Relationship, open the Foreign key relationship window

Click the Add button, select the option button for the table and column specification row,

Select Primary key table, field, and foreign key table, field, OK, save

Verify that the modification type is a nonexistent type, and that the foreign KEY constraint conflict will be prompted when saving. Verification Success!

Create a View

Select the database, right-click the View node, select New View

In the Add Table window, click on the Product table, click Add, the Query window appears a view of the product table, and then click Close.

Then the query window click need to show the "Product Name", "brand", "Price", click the Execute button, you can display the table information in the bottom window, the field is checked.

Finally, save the view with the name "Product Overview" and the view is created.

Refresh, you can see the saved view in the View node.

Other views can have advanced filtering criteria, such as sorting, or qualifying conditions

The following is sorted by price, sales price is greater than 1300, made a filter, save as "high-priced goods" view.

Changes to the View

Deletion of views

SQL serever Learning 6--Data Sheet 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.