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 :: postgre describe table 
Sql :: sql count number of rows after group by 
Sql :: find the median in sql 
Sql :: left join in codeigniter query builder 
Sql :: add primary key with auto increment to existing table column mysql 
Sql :: RowDataPacket 
Sql :: sql check duplicate value in column 
Sql :: view databases in mysql 
Sql :: check if value is equal to something sql 
Sql :: CONVERT time string into 12 hours in sql 
Sql :: postgresql create role 
Sql :: sql groub by count 
Sql :: postgresql get date now 
Sql :: mysql money value 
Sql :: mysql version 
Sql :: mssql dockere 
Sql :: mysql permissions 
Sql :: sql distinct only one column 
Sql :: mysql delete entire row on condition 
Sql :: sql constraint check value in list 
Sql :: como consultar registros duplicados en mysql 
Sql :: python simple connect to mysql 
Sql :: mysql 8 geo to json 
Sql :: update trigger 
Sql :: mysql select statement after index 
Sql :: list table columns sql 
Sql :: sql having clause 
Sql :: sql auto_increment syntax 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =