• 0

[SQL] FILTER COLUMNS IN A SELECT STATEMENT


Question

Hi!

Wanted to select * from students

but wanted to filter out the Age for example

Basically i want to write up a query in which i would specify columns i dont want rather than the ones i do.

Thanks.

Newton

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

All you have to do is include the names of the columns you want in the select clause. For example:

SELECT student_id, firstname, surname FROM students

You have to list the columns you want to include rather than exclude the ones you're not interested in.

Link to comment
Share on other sites

  • 0

i know that, but i am dealing with tables with over 20 columns. Thats why i was wondering if there was a way of selecting a table and excluding the ones im not interested in.

Link to comment
Share on other sites

  • 0

Sorry, the SQL language does not allow for ALL, EXCEPT(A,B,)

Interesting idea thought. You'll have to start learning that creating big queries involves a good editor (my fav is Toad) or a good ability to know the language. btw: 20 fields is not that many.

Good luck

Link to comment
Share on other sites

  • 0
depends what type of application it is ;)

The type of application is meaningless.

The type of data and number of rows is important. Memory is used to hold the info.

Link to comment
Share on other sites

  • 0

20 fields? Sheesh, at that point, you're better off creating 2 smaller tables with like half the columns, rather than 1 big table with all the columns

Link to comment
Share on other sites

  • 0
The type of application is meaningless.

The type of data and number of rows is important. Memory is used to hold the info.

ok, thats true as well

transactional application 20 cols is not many, analytical is a different kettle of fish (depending on datatype and number of rows)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.