I have the following SQL query which I am sending from a C# program: DECLARE @id as int SELECT @id = max(fault_catagory_ident) FROM fault_catagory_list INSERT INTO fault_catagory_list (…
Tag: sql-insert
ERROR: invalid input syntax for type numeric (SQL)
I’ve created a data set with Mockaroo and then added the file with cmd. But I am getting this error. ERROR: invalid input syntax for type numeric: The table definiton is this : create table car( id …
Convert a json which is a list of dictionaries into column/row format in Postgresql
I´ve a json which is a list of dictionaries with the next syntax: The json is really big and each dictionary have different amount of key/values fields. And what I want to do is to create a table in postgresSQL where the key represents a column and the value a row. In the example explained above I would like table
What did I miss in this MariaDB query? I’m getting now a SQL syntax error
Every time I get Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘by, user, reason, active) VALUES (5, 663403380223377400, 793061601288388600, 274’. Did I miss something in the query? MariaDB version: 10.1.47 Kind Regards, Corné Answer by is a reserved word in MySQL
How to add specific number of empty rows in sqlite?
I have a SQLite file and I want to add 2550 empty (NULL) rows. I am able to add one empty line with this code But I need 2550 rows. Is there any shortcut for it? I don’t want to execute same code 2550 times. Answer If your version of SQLite support it, you could use a recursive CTE to
put on duplicate key update in MySQL
let’s say i have 2 tables table shipping id origin order_id createdAt product_id amount 1 1 11 2020-12-22 234 2000 2 1 11 2020-12-22 235 3000 3 1 11 2020-12-22 236 4000 4 2 12 2020-12-22 236 3000 5 2 12 2020-12-22 235 2100 6 3 13 2020-12-22 236 2200 7 3 13 2020-12-22 239 3400 8 4 14 2020-12-22
Can’t Insert into seperate column while using two select statements
TABLE: NAME : Jance C hiatt, Sam, Brook, Newyork, London ADDRESS : NULL,NULL,NULL,NULL NewYork and London should be address column but it is showing on Name itself Here address is not coming at the separate column of database. Kindly tell me what issue I am facing Answer Each insert statement creates new rows, so you cannot expect your queries to
When inserting multiple record into a SQL table it does not follow the order
When using a single insert statement to add multiple records into a table as shown below, it does not follow the same order when selecting. I understand that it does not affect anything but may I know …
SQL Insert JSON into table column
while searching for a way to insert array into single db columns, I found an article about inserting JSON string. However it wasn’t explained how. I tried to search and find the way with no success. I have the following table: What i want to do is insert a Json arry in the address column. like: I thought about inserting
PHP Prepared MySQL UPDATE Statement with Variable inside of a string
I am trying to include a variable inside of a string in an update query but seem to be having trouble. I am just now updating all of my old websites to use prepared statements so I am not that familiar with them yet. What do I need to do to get the string and variable connected in the query.