Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:35:14+00:00 2026-05-22T18:35:14+00:00

Using sql, i need to make Lineno and orderline into a composite key how

  • 0

Using sql, i need to make Lineno and orderline into a composite key how can i do this this, so far i’ve got

CREATE TABLE ORDERLINE (
   ORDERNO INTEGER NOT NULL, 
   LINENO VARCHAR(4) NOT NULL, 
   NUMBERORDERED NUMERIC DEFAULT '1', 
   QUOTEDPRICE NUMERIC DEFAULT '0.00', 
   CONSTRAINT ORDERLINE_ORDERNO_PK PRIMARY KEY (ORDERNO), 
   CONSTRAINT ORDERLINE_ORDERNO_CC CHECK (ORDERNO BETWEEN 10000 AND 99999), 
   CONSTRAINT ORDERLINE_NUMBERORDERED CHECK (NUMBERORDERED BETWEEN 1 AND 100) 
);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:35:15+00:00Added an answer on May 22, 2026 at 6:35 pm
    CREATE TABLE ORDERLINE (
        ORDERNO INTEGER NOT NULL,
        LINENO VARCHAR(4) NOT NULL,
        NUMBERORDERED NUMERIC DEFAULT '1',
        QUOTEDPRICE NUMERIC DEFAULT '0.00',
        CONSTRAINT ORDERLINE_ORDERNO_PK PRIMARY KEY(ORDERNO, LINENO), -- note alteration on this line
        CONSTRAINT ORDERLINE_ORDERNO_CC CHECK (ORDERNO BETWEEN 10000 AND 99999),
        CONSTRAINT ORDERLINE_NUMBERORDERED CHECK (NUMBERORDERED BETWEEN 1 AND 100)
    );
    

    You’re very close. Note the addition of the column name above.

    Identify which field is more likely to be a leading column in any query and put it first. For example; if you often access by OrderNO, LineNo that would be the best order, if however you access by LineNo, OrderNO go with that order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a sql query (using Firebird as the RDBMS) in which I need
I need to import a large CSV file into an SQL server. I'm using
I am using SQL Advantage and need to know what the SQL is to
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I am generating a reports using SQL Reporting services 2005. I need to protect
I am using LINQ-to-SQL for an application that queries a legacy database. I need
I am using Installshield 2008 Developer Edition and need to run SQL scripts against
I'm using C# and .NET 3.5. I need to generate and store some T-SQL
Using SQL Server, how do I split a string so I can access item
Using sql server 2000, I would like to take my production data and put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.