Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

Why is SELECT * bad practice? Wouldn't it mean less code to change if you added a new column you wanted?

I understand that SELECT COUNT(*) is a performance problem on some DBs, but what if you really wanted every column?

1 Answer

0 votes
by (119k points)

SELECT * is bad practice because it is most expensive to query data when you need only a couple of columns. If you want to retrieve only a few columns of that table then using SELECT * is just the additional and unnecessary work for the database server. Using SELECT *  when needed only specific columns lead to unnecessary information that has to be passed over the database server. This consumes more processing time when you have huge data.

If you wish to learn to write optimal SQL queries, you can check out this SQL Training course by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 10, 2019 in SQL by Tech4ever (20.3k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...