0

Consider these tables:

  1. Brands (Id, Name, Logo, Ratings)
  2. Products (Id, Title, Picture, Price)

Is it possible to use star selection to select ALL but ID fields from the Brands table in a join?

create view ProductViews
as
select
    p.*,
    -- Is it possible to use star selection to select all fields of the Brands, except the Id field?
    b.Name,
    b.Logo,
    b.Ratings
from Products p
inner join Brands b
on p.BrandId = b.Id

1 Answer 1

1

Is it possible to use star selection to select ALL but ID fields...

No, not without already explicitly listing all the columns you want in a view or CTE first, and then using SELECT * FROM SuchViewOrCTE.

You also shouldn't be using SELECT * most times because it is an anti-pattern that can affect performance and result in broken code as schema changes occur:

  1. Why is SELECT * considered harmful?
  2. "SELECT *" why is it an antipattern
  3. What is the reason not to use select *?
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.