sql-insert

LiveSQL keeps showing me this: ORA-00933: SQL command not properly ended [duplicate]

北城以北 提交于 2021-02-04 21:46:58
问题 This question already has answers here : Insert multiple records in oracle (3 answers) Closed 3 months ago . INSERT INTO Countries (Country, Capital, Cities) VALUES ('Philippines','Manila',122), ('USA','Washington',19495), ('Brazil','Brasilia',1642), ('Latvia','Riga',9), ('Egypt','Cairo',124) ; I've tried removing the (Country, Capital, Cities) , sticking it back on, putting them all in the same line, putting bigger indents, spacing them out. nothing. It keeps throwing me this error: ORA

PSQL [error] - value being recognized as a column

微笑、不失礼 提交于 2021-02-04 21:36:34
问题 I just started learning database a couple of days ago. I'm running into this problem where my value is being recognized as a column, and it's spitting out an error. This is my News table: id | bodyText | url | createdAt | updatedAt ----+----------+-----+-----------+----------- this is the command I ran in psql: INSERT INTO "News" ("bodyText") VALUES ("this is a test"); and this is the error I'm getting: ERROR: column "this is a test" does not exist LINE 1: INSERT INTO "News" ("bodyText")

PSQL [error] - value being recognized as a column

孤人 提交于 2021-02-04 21:36:03
问题 I just started learning database a couple of days ago. I'm running into this problem where my value is being recognized as a column, and it's spitting out an error. This is my News table: id | bodyText | url | createdAt | updatedAt ----+----------+-----+-----------+----------- this is the command I ran in psql: INSERT INTO "News" ("bodyText") VALUES ("this is a test"); and this is the error I'm getting: ERROR: column "this is a test" does not exist LINE 1: INSERT INTO "News" ("bodyText")

Insert ID into SQL from C# Combo box

微笑、不失礼 提交于 2021-01-29 20:45:17
问题 I have a dropdown(combo) box in a C# program I'm writing. -It pulls through its data from a table in my database: Application_Id | Application ---------------|-------------- 1 |Name1 2 |Name2 3 |Name3 The code for the dropdown box looks like this: SqlConnection conn = new SqlConnection(SqlCon.DBCON); conn.Open(); SqlCommand sc = new SqlCommand("select * from Application", conn); SqlDataReader reader; reader = sc.ExecuteReader(); DataTable dt = new DataTable(); dt.Columns.Add("ApplicationId",

Convert Oracle SQL query to Azure SQL query

偶尔善良 提交于 2021-01-29 10:02:34
问题 I have a pretty long Oracle SQL query that needs to be compatible for Azure SQL. I am new to both database types. Here is query: MERGE INTO studies USING dual ON (study_id = :study_id) WHEN NOT MATCHED THEN INSERT (study_id, study_date) VALUES (:study_id, :study_date) I am not sure USING dual would work. I read some solution saying that USING dual is not necessary in SQL Server. I really appreciate if you can explain what this query means and how I can translate this for Azure SQL query. 回答1:

Update multiple columns on conflict postgres

℡╲_俬逩灬. 提交于 2021-01-29 06:40:50
问题 I have to write a query to update a record if it exists else insert it. I am doing this update/insert into a postgres DB. I have looked into the upsert examples and most of them use maximum of two fields to update. However, I want to update multiple columns. Example: query="""INSERT INTO table (col1,col2,col3,col4,col5,col6,col7,col8,col9,..col20) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) ON CONFLICT(col2) DO UPDATE SET (col1,col2,col3,col4,col5,col6,col7,col8,col9,.

How to remove a single quote from a value while inserting in SQL database

扶醉桌前 提交于 2021-01-29 04:20:33
问题 I have a long list of insert query which has a slight error. INSERT INTO `delivery_zip` (..) VALUES ("AB'C / DEF", ..), ("AB'C / DEF", ..), ("AB'C / DEF", ..), ... How do I remove the single quote after AB' from the values. 回答1: If the single quote in question is the only single quote present in the column col1 , and you have already inserted the data, then you should be safe using UPDATE with REPLACE to remove it: UPDATE delivery_zip SET col1 = REPLACE(col1, ''', '') But if you haven't done

Insert data into sqlite3 database with API

瘦欲@ 提交于 2021-01-27 19:27:24
问题 I'm trying to insert data from a web API into my database (I am using sqlite3 on python 3.7.2) and I can't find any tutorials on how do to so. So far all my code is: import requests, sqlite3 database = sqlite3.connect("ProjectDatabase.db") cur = database.cursor() d = requests.get("http://ergast.com/api/f1/2019/drivers") I'm aiming to get the names and driver numbers of each driver and insert them all into a table called Drivers. (I'm also using more APIs with more tables, but if I figure out

POSTGRES - prevent serial incrementation with ON CONFLICT DO NOTHING [duplicate]

偶尔善良 提交于 2021-01-27 19:07:47
问题 This question already has answers here : serial in postgres is being increased even though I added on conflict do nothing (4 answers) Closed 5 months ago . duplicate of this question Say I have the following table things. I want unique names in the table so there are no duplicates. The process that inserts a thing shouldn't need to check if a thing with this name is already there. CREATE TABLE things( id SMALLSERIAL PRIMARY KEY, name varchar UNIQUE ); When I insert values like this it works.

Is there a non-commercial alternative to Z.EntityFramework.Extensions? [closed]

╄→гoц情女王★ 提交于 2021-01-21 03:44:50
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Entity Framework can be very slow on mass insert/update/delete operations. Even the often suggested tweaks to turn off AutoDetectChanges and/or ValidateOnSaveEnabled does not always help. I have come across the Z.EntityFramework.Extensions on NuGet, but it seems