Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

multiple-records

How to delete multiple rows with 2 columns as composite primary key in MySQL?

May 8, 2023 by Tarik

The answer in Oracle is: delete from cpi where (countryid, year) in ((‘AD’, 2010), (‘AF’, 2009), (‘AG’, 1992)) It’s fairly standard SQL syntax and I think MySQL is the same.

Categories mysql Tags composite-primary-key, multiple-records, mysql, sql-delete Leave a comment

MySQL delete multiple rows in one query conditions unique to each row

February 12, 2023 by Tarik

You were very close, you can use this: DELETE FROM table WHERE (col1,col2) IN ((1,2),(3,4),(5,6)) Please see this fiddle.

Categories mysql Tags multiple-records, mysql, unique-constraint Leave a comment

How do I insert multiple values into a postgres table at once?

December 12, 2022 by Tarik

Multi-value insert syntax is: insert into table values (1,1), (1,2), (1,3), (2,1); But krokodilko’s answer is much slicker.

Categories postgresql Tags multiple-records, postgresql, sql-insert Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa