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 6615355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:27:06+00:00 2026-05-25T20:27:06+00:00

I was reading a SQL cookbook type reference, and I came across a statement

  • 0

I was reading a SQL “cookbook” type reference, and I came across a statement that I has never come across before:

INSERT INTO table (col1, col2)
SELECT t.col1, 8
FROM table AS t
WHERE t.col2 = 5
UNION ALL
SELECT 8, 8

Now what confuses me is a number (in this example, 8) immediately following the SELECT statement. In my limited SQL experience, I have only come across SELECT queries that are followed by column names. Could somebody help me understand what this does? Thanks!

  • 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-25T20:27:07+00:00Added an answer on May 25, 2026 at 8:27 pm

    The SELECT 8, 8 does exactly what it appears to do; it returns a result set with 2 un-named columns each containing 8 – if you run just that statement yourself you’ll see exactly that.

    You are free to select literal values & expressions just as you are columns, function results etc;

    SELECT 'cake', 123 + 456
    

    The UNION ALL merges (non-duplicate) rows from the 1st table select with the result of the 2nd select so your inserting a single additional (8,8) row into the table.

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

Sidebar

Related Questions

I was reading the Maximum Capacity Specifications for SQL Server and I came across
I have a LINQ to SQL class that I am reading into a List.
When reading about SQL I've come across the term 'slot'. For example, in a
I'm reading a book about SQL. In that book, I saw strange query below:
I'm reading a book about SQL. In that book there's the term Ad Hoc
I have been reading that direct access to a SQL Server database over the
I'm having a problem reading data from a text file into ms sql. I
I'm reading a csv file and insert the information in a sql 2005 database.
I am reading from a text file in C# using a SQL statement. This
I keep reading that SQL Azure doesn't support relational databases; however, I just tapped

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.