Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql select into new table

-- Insert into existing my_table
INSERT INTO my_table my SELECT * FROM another_table an WHERE an.col1 > 10;
-- or directely create the new table
CREATE TABLE my_table AS SELECT * FROM another_table an WHERE an.col1 > 10;
Comment

mysql select into new table

CREATE TABLE artists_and_works
  SELECT artist.name, COUNT(work.artist_id) AS number_of_works
  FROM artist LEFT JOIN work ON artist.id = work.artist_id
  GROUP BY artist.id;
Comment

mysql create table from select statement

select * into <NEW_TABLE_NAME> from <OLD_TABLE>;
Comment

PREVIOUS NEXT
Code Example
Sql :: events mysql 
Sql :: read all columns of a table sql 
Sql :: how to query without duplicate rows in sql 
Sql :: postgres : ERROR: division by zero 
Sql :: mysql record group by created date count 
Sql :: sql convert varchar to date 
Sql :: mysql show schema 
Sql :: update and replace mysql 
Sql :: sql all columns 
Sql :: mysql local password denied 
Sql :: if null mysql 
:: sql datetime format dd/mm/yyyy hh:mm am/pm 
Sql :: get column types SQL SERVER 
Sql :: Cast for print sql 
Sql :: declarative base sqlalchemy 
Sql :: how to connect sql database in python 
Sql :: mysql export database command line 
Sql :: sql substring 
Sql :: mysql collation for all languages 
Sql :: change magento database url usimg musql 
Sql :: mysql declare variable 
Sql :: SQL Server Altering Column to be Unique 
Sql :: add time to date sql 
Sql :: flask marshmallow sqlalchemy 
Sql :: get yesterday date ISO in psql 
Sql :: setval max id postgresql sequence 
Sql :: how to find special characters in sql 
Sql :: sql integer to serial 
Sql :: postgresql check total storage 
:: show table info mysql 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =