0 votes
1 view
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 (73.7k 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)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...