Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select multiple columns from a table excluding some columns?

Tags:

sql

mysql

How to select multiple columns from a table excluding some columns?

I tried:

SELECT *!=[column name i want to exclude] from tablename;

it didn't work.

like image 703
sriram unnam Avatar asked Dec 02 '15 10:12

sriram unnam


People also ask

Should I use * or column list when selecting all columns?

Also, as mentioned in Joe's comment, it is usually considered good practice to explicitly specify column list as opposed to "*" even when selecting all columns. The reason for that is that having * in a joined query may cause the query to break if a table schema change introduces identically-named fields in both of the joined tables.

How to select first two columns in a table in Excel?

Example 1: Select first two column. # slice inclusive of the ending index. Example 2: Select all or some columns, one to another using .iloc. Select all or some columns, one to another using .ix.

How to select multiple columns in SQL with or without condition?

Selecting multiple columns in SQL with or without any condition is as simple as selecting a single column and not only simple but also the same as that.

What are the examples of multiple columns in SQL?

Similarly, another example of multiple columns can be: Write a query which gave the names and salary of all employees working in an organization. So here we have to select 2 columns of name and salary. The examples above make us understand that selection of columns is very important while learning SQL.


1 Answers

select column1, column2, column4, column7
from tablename;

should be the way to go.

like image 72
Non Plus Ultra Avatar answered Oct 12 '22 23:10

Non Plus Ultra