devxlogo

Formatting SQL Results

Formatting SQL Results

Question:
I am trying to select data from three columns of a table listing all tables of a database. The table_name column is repeated with each separate column_namecolumn, hence the table_name is duplicated by the no. of column_names in the table. How do I force the output to just contain the distinct table_name and all the differentcolumn_name columns i.e. in the format:

    table_name      column_name                    column_name                    column_name                    column_name    table_name      column_name                    column_name    …

Answer:
Formatting capabilities are not part of most SQL implementations.However, many tools, such as report writers, will allow you to format the output so that repeating data is not duplicated.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist