How to select all the columns of a table except one column?
You can use this approach to get the data from all the columns except one:-
- Insert all the data into a temporary table
- Then drop the column which you dont want from the temporary table
- Fetch the data from the temporary table(This will not contain the data of the removed column)
- Drop the temporary table
Something like this:
SELECT * INTO #TemporaryTable FROM YourTableName
ALTER TABLE #TemporaryTable DROP COLUMN Columnwhichyouwanttoremove
SELECT * FROM #TemporaryTable
DROP TABLE #TemporaryTable
Select all column except one column in bigquery
How to Select all columns of a table except one
Create the table with all the columns and after that drop the geom
column and rename the new one:
CREATE TABLE tableC AS
SELECT
tableA.*,
ST_Intersection (B.geom, A.geom) as geom2 -- generate geom
FROM
tableA inner JOIN tableB ON ST_Intersects (A.geom, b.geom)
WHERE test.id = 2
;
alter table tableC drop column geom;
alter table tableC rename column geom2 to geom;
Select all columns except one in MySQL?
Actually there is a way, you need to have permissions of course for doing this ...
SET @sql = CONCAT('SELECT ', (SELECT REPLACE(GROUP_CONCAT(COLUMN_NAME), '<columns_to_omit>,', '') FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<table>' AND TABLE_SCHEMA = '<database>'), ' FROM <table>');
PREPARE stmt1 FROM @sql;
EXECUTE stmt1;
Replacing <table>, <database> and <columns_to_omit>
Related Topics
Retrieve String Between HTML Tags Using Regex
How to Select the Last Record of a Table in SQL
Force a Value of 0 for Non-Existing Value
Mysql - Trigger for Updating Same Table After Insert
Select All Dates Between First Day of Month and Current Date
Sql. How to Check If Record Exists in Table
Wamp Server Error [Local Server - 2 of 3 Services Running]
How to Pass Multiple Values to Single Parameter in Stored Procedure
Avoid Duplicates in Insert into Select Query in SQL Server
Sql: Select All Rows If Parameter Is Null, Else Only Select Matching Rows
How to Create Column in SQL Query With Custom Text
How to Kill/Stop a Long SQL Query Immediately
Retrieve Varbinary Value as Base64 in Mssql
Total Sum of Multiple Columns in Oracle SQL Statement by Unique Id
Disable Secure Priv for Data Loading on MySQL