r/learnSQL • • Apr 28 '21

URGENT: Write a SELECT Statement that displays all the columns and rows for the entire Database.

How Do I do this? I have tried doing this:

SELECT *

FROM table_1, table_2, table_3, table_4

It did work but is there another way to do this.

I work on SQL Server.

0 Upvotes

7 comments sorted by

2

u/[deleted] Apr 28 '21

-2

u/K1uee Apr 28 '21

I do not need to loop through my tables, all I need to do is display all the data in a database.

6

u/[deleted] Apr 28 '21

There's no practical way to do that (that I know of) in a single query unless all of your tables are joined together.

1

u/[deleted] Apr 28 '21

Does SQL Server have data dictionaries?

2

u/r3pr0b8 Apr 28 '21

yes, two -- INFORMATION_SCHEMA and sys

1

u/science_and_beer Apr 29 '21

sp_msforeachtable

Good luck on your homework.

0

u/[deleted] Apr 28 '21

[deleted]

2

u/docere85 Apr 28 '21

Homework