When using this SQL query: "Select * from table_name"
what happens if the name of the table contains blankspaces? Is there an special SQL sintax for selecting a table with a name such as "Author Code"?
When using this SQL query: "Select * from table_name"
what happens if the name of the table contains blankspaces? Is there an special SQL sintax for selecting a table with a name such as "Author Code"?
It depends on which database you are using.
Any object in SQL can have any name. You just need to put square brackets around it. [Like this]
or [^!@*@# EVEN THIS @#(*@#)]
or even [SELECT]
.
I use this frequently in column aliases to make my reports purdy.
select
c.first_name + ' ' + c.last_name as [Customer Name],
o.order_number as [Order #],
o.total_amount as [Total Amount],
o.order_date as [Date]
from
customer c
order o ON o.customer_id = c.customer_id
....