Advertisement
niammuddin

perintah sql

Sep 28th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 2.63 KB | None | 0 0
  1.  
  2.  
  3. No, Product Id, Product Url, Product Name, Brand, Category level 1, Category level 2, Category level 3, Price, Discount Price, Color, Availability, Gender, Image link 1, Image link 2, Image link 3, Affiliate, Link Affiliate
  4.  
  5.  
  6.  
  7. SELECT no, nama, alamat, url
  8. FROM
  9. (
  10.     SELECT * from table1
  11.     UNION ALL
  12.     SELECT * from table2
  13. ) t
  14. ORDER BY no ASC
  15.  
  16.  
  17.  
  18. Select * from bukalapak UNION select * FROM tokopedia
  19.  
  20. ALTER TABLE bukalapak DROP COLUMN No;
  21.  
  22.  
  23. ALTER TABLE all_column ADD No bigint(20);
  24.  
  25. ALTER TABLE bukalapak,tokopedia,blibli,mataharimall,thechildrenstore DROP COLUMN No;
  26.  
  27.  
  28. CREATE TABLE newcolumn as
  29. Select * from bukalapak,tokopedia,blibli,mataharimall,thechildrenstore UNION select * FROM bukalapak,tokopedia,blibli,mataharimall,thechildrenstore
  30.  
  31.  
  32. UPDATE all_column
  33. JOIN (SELECT @rank := 0) r
  34. SET No=@rank:=@rank+1;
  35.  
  36. ALTER TABLE bukalapak ADD No int IDENTITY(1, 2) NOT NULL
  37. ALTER TABLE bukalapak ADD (No char(30);
  38. ALTER TABLE bukalapak ADD No VARCHAR2(20) DEFAULT 'N';
  39. ALTER TABLE table_name ADD column_name varchar2(1) DEFAULT 'N' not null;
  40.  
  41. SELECT nama_tabel_tampil   .   nama_kolom_tampil FROM nama_tabel_pertama INNER JOIN nama_tabel_kedua ON nama_tabel_pertama . kolom_penghubung = nama_tabel_kedua . kolom_penghubung ;
  42.  
  43.  
  44. SELECT *
  45. FROM bukalapak INNER JOIN tokopedia
  46. ON (tokopedia.Product Id, tokopedia.Product Url, .tokopedia.Product Name, tokopedia.Brand, tokopedia.Category level 1, tokopedia.Category level 2, tokopedia.Category level 3, tokopedia.Price, tokopedia.Discount Price, tokopedia.Color, tokopedia.Availability, tokopedia.Gender, tokopedia.Image link 1, tokopedia.Image link 2, tokopedia.Image link 3, tokopedia.Affiliate, tokopedia.Link Affiliate)=(bukalapak.Product Id, bukalapak.Product Url, .bukalapak.Product Name, bukalapak.Brand, bukalapak.Category level 1, bukalapak.Category level 2, bukalapak.Category level 3, bukalapak.Price, bukalapak.Discount Price, bukalapak.Color, bukalapak.Availability, bukalapak.Gender, bukalapak.Image link 1, bukalapak.Image link 2, bukalapak.Image link 3, bukalapak.Affiliate, bukalapak.Link Affiliate)
  47.  
  48.  
  49.  
  50. SELECT ROW_NUMBER() OVER (ORDER BY "Product Id" ASC) AS No, Product Id, Product Url, Product Name, Brand, "Category level 1", "Category level 2", "Category level 3", Price, Discount Price, Color, Availability, Gender, "Image link 1", "Image link 2", "Image link 3", Affiliate, Link Affiliate
  51. FROM tokopedia
  52.  
  53. UPDATE produk SET `slug` = `Product Name`
  54.  
  55. To add primary key in the column.
  56.  
  57. ALTER TABLE table_name ADD PRIMARY KEY (column_name);
  58. To remove primary key from the table.
  59.  
  60. ALTER TABLE table_name DROP PRIMARY KEY;
  61.  
  62. UPDATE table SET field1 = field2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement