Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

CHAPTER 5: Defining Tables > Defining the Remaining Tables

Defining the Remaining Tables

Now that three of the tables have been created, you need to create the remaining three tables. You will do this as code placed in Query Editor. There is nothing specifically new to cover in this next section, and therefore only the code is listed. Enter the following code and then execute it as before. You can then move into SQL Server Management Studio and refresh it, after which you should be able to see the new tables. Note that the CustomerDetails.CustomerProducts and CustomerDetails.FinancialProducts tables have no IDENTITY columns. These two tables will be used in Chapter 14 to demonstrate how the SEQUENCE object works as an alternative to IDENTITY.

    USE ApressFinancial
    GO
    CREATE TABLE CustomerDetails.CustomerProducts(
                 CustomerFinancialProductId int NOT NULL,
                 CustomerId int NOT NULL,
                 FinancialProductId int NOT NULL,
                 AmountToCollect money NOT NULL,
                 Frequency smallint NOT NULL,
                 LastCollected datetime NOT NULL,
                 LastCollection datetime NOT NULL,
                 Renewable bit NOT NULL
    )
    ON [PRIMARY]
    GO
    CREATE TABLE CustomerDetails.FinancialProducts(
                 ProductId int NOT NULL,
                 ProductName nvarchar(50) NOT NULL
    ) ON [PRIMARY]
    
    GO
    CREATE TABLE ShareDetails.SharePrices(
                 SharePriceId bigint IDENTITY(1,1) NOT NULL,
                 ShareId int NOT NULL,
                 Price numeric(18, 5) NOT NULL,
                 PriceDate datetime NOT NULL
    ) ON [PRIMARY]
    
    GO

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint