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 :: sql null functions 
Sql :: Join base on multiple or conditions 
Sql :: join creating duplicate columns sqllite 
Sql :: SQL SERVER xquery count child nodes 
Sql :: python sqlalcahmey compare datetime using extract 
Sql :: convert sql query to linq online 
Sql :: añadir clave foranea mysql 
Sql :: Sauvegarde complète my sql 
Sql :: difference between on and where in sql 
Sql :: How to do a cumulative count using Raw SQl / Laravel - Eloquent ORM 
Sql :: Sql select by content lenght 
Sql :: triggers in mysql 
Sql :: how to check table in postgresql from terminal 
Sql :: mysql procedure between two tables 
Sql :: deny select insert update delete sql 
Sql :: distinct data types in a table sql query 
Sql :: plsql to generate all combinations of specified number of characters in string 
Sql :: for each row trigger postgresql 
Sql :: Inner join steps 
Sql :: calcul age 
Sql :: SQL CHECK Constraint in Existing Table 
Sql :: how to import datadd in sql 
Sql :: sqlite closes value 
Sql :: mysql export search results 
Sql :: sql "List the contact methods found in the Contact table.For each contact method, list how many people chose that contact method." 
Sql :: pl sql trigger update sysdate 
Sql :: Select all columns except one in MySQL? 
Sql :: Shell Comands 
Sql :: mysql grant user wildcard database 
Sql :: sql query to get contact form 7 fields 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =