What is the 't' mean at end of the subquery in SQL Server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have following code used for query data by rows and start point:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100 and InquiryId <= 200)t
where Seq Between 1 and 20
What is character 't' means at the end of the forth row in SQL server?
Thanks
sql
add a comment |
I have following code used for query data by rows and start point:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100 and InquiryId <= 200)t
where Seq Between 1 and 20
What is character 't' means at the end of the forth row in SQL server?
Thanks
sql
3
tis an alias for the sub-query. it can be anything other than a reserved keyword
– Vamsi Prabhala
Nov 15 '18 at 16:05
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07
add a comment |
I have following code used for query data by rows and start point:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100 and InquiryId <= 200)t
where Seq Between 1 and 20
What is character 't' means at the end of the forth row in SQL server?
Thanks
sql
I have following code used for query data by rows and start point:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100 and InquiryId <= 200)t
where Seq Between 1 and 20
What is character 't' means at the end of the forth row in SQL server?
Thanks
sql
sql
asked Nov 15 '18 at 16:04
Zeqing ZhangZeqing Zhang
1,41021424
1,41021424
3
tis an alias for the sub-query. it can be anything other than a reserved keyword
– Vamsi Prabhala
Nov 15 '18 at 16:05
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07
add a comment |
3
tis an alias for the sub-query. it can be anything other than a reserved keyword
– Vamsi Prabhala
Nov 15 '18 at 16:05
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07
3
3
t is an alias for the sub-query. it can be anything other than a reserved keyword– Vamsi Prabhala
Nov 15 '18 at 16:05
t is an alias for the sub-query. it can be anything other than a reserved keyword– Vamsi Prabhala
Nov 15 '18 at 16:05
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07
add a comment |
3 Answers
3
active
oldest
votes
Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t
Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t
add a comment |
It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100
and InquiryId <= 200
) AS t
where Seq Between 1 and 20
add a comment |
doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323405%2fwhat-is-the-t-mean-at-end-of-the-subquery-in-sql-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t
Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t
add a comment |
Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t
Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t
add a comment |
Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t
Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t
Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t
Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t
answered Nov 15 '18 at 16:08
Aaron DietzAaron Dietz
8,6121924
8,6121924
add a comment |
add a comment |
It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100
and InquiryId <= 200
) AS t
where Seq Between 1 and 20
add a comment |
It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100
and InquiryId <= 200
) AS t
where Seq Between 1 and 20
add a comment |
It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100
and InquiryId <= 200
) AS t
where Seq Between 1 and 20
It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId, ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100
and InquiryId <= 200
) AS t
where Seq Between 1 and 20
answered Nov 15 '18 at 16:07
Eray BalkanliEray Balkanli
4,65852347
4,65852347
add a comment |
add a comment |
doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
add a comment |
doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
add a comment |
doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col
doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col
edited Nov 15 '18 at 16:45
answered Nov 15 '18 at 16:17
David MarabottiniDavid Marabottini
1707
1707
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
add a comment |
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
1
1
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
The subquery is named not any table in it.
– alk
Nov 15 '18 at 16:41
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
I have corrected, however it works with subquery and with table
– David Marabottini
Nov 15 '18 at 16:46
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
Perhaps a language issue? Still, I do not see any significant changes in your answer.
– alk
Nov 15 '18 at 18:56
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323405%2fwhat-is-the-t-mean-at-end-of-the-subquery-in-sql-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
tis an alias for the sub-query. it can be anything other than a reserved keyword– Vamsi Prabhala
Nov 15 '18 at 16:05
I can't find a canonical Q&A for SQL Server aliases, but this should help stackoverflow.com/questions/4981481/… or stackoverflow.com/questions/198196/when-to-use-sql-table-alias
– DavidG
Nov 15 '18 at 16:07