sql

SQL Error: ORA-00913: too many values

只谈情不闲聊 提交于 2021-02-20 05:48:05
问题 Two tables are identical in terms of table name, column names, datatype and size. These tables are located in separate databases, but I am use to current Log in in hr user. insert into abc.employees select * from employees where employee_id=100; I can not give use original query from corporate office. Error starting at line 1 in command: insert into abc.employees select * from employees where employee_id=100; Error at Command Line:1 Column:25 Error report: SQL Error: ORA-00913: too many

How to find specific links between two tables

╄→尐↘猪︶ㄣ 提交于 2021-02-20 05:13:14
问题 I have lots of tables and lots of relationships between them. When I try to make some join between them I'm stuck at finding the relationship between the two tables. For the sake of simplicity let's say I have Table A and Table B . They are linked with a foreign key. Q: How can I find the foreign key between this two exact tables and the column it references? And not all the tables or foreign keys that have a reference to this table. 回答1: You can join the data dictionary constraint-related

How to find specific links between two tables

时间秒杀一切 提交于 2021-02-20 05:10:55
问题 I have lots of tables and lots of relationships between them. When I try to make some join between them I'm stuck at finding the relationship between the two tables. For the sake of simplicity let's say I have Table A and Table B . They are linked with a foreign key. Q: How can I find the foreign key between this two exact tables and the column it references? And not all the tables or foreign keys that have a reference to this table. 回答1: You can join the data dictionary constraint-related

How to find specific links between two tables

╄→尐↘猪︶ㄣ 提交于 2021-02-20 05:10:51
问题 I have lots of tables and lots of relationships between them. When I try to make some join between them I'm stuck at finding the relationship between the two tables. For the sake of simplicity let's say I have Table A and Table B . They are linked with a foreign key. Q: How can I find the foreign key between this two exact tables and the column it references? And not all the tables or foreign keys that have a reference to this table. 回答1: You can join the data dictionary constraint-related

How to find specific links between two tables

这一生的挚爱 提交于 2021-02-20 05:09:20
问题 I have lots of tables and lots of relationships between them. When I try to make some join between them I'm stuck at finding the relationship between the two tables. For the sake of simplicity let's say I have Table A and Table B . They are linked with a foreign key. Q: How can I find the foreign key between this two exact tables and the column it references? And not all the tables or foreign keys that have a reference to this table. 回答1: You can join the data dictionary constraint-related

How to find specific links between two tables

社会主义新天地 提交于 2021-02-20 05:06:56
问题 I have lots of tables and lots of relationships between them. When I try to make some join between them I'm stuck at finding the relationship between the two tables. For the sake of simplicity let's say I have Table A and Table B . They are linked with a foreign key. Q: How can I find the foreign key between this two exact tables and the column it references? And not all the tables or foreign keys that have a reference to this table. 回答1: You can join the data dictionary constraint-related

How to add 2 foreign keys in a table in a SQL Server?

时光总嘲笑我的痴心妄想 提交于 2021-02-20 04:57:59
问题 I have 2 tables, one of them has 2 foreign keys and another has 2 composite foreign keys in it. Whenever I try to run the query, it says error and could not create constraint or index. So I have two tables here. I know I'm completely wrong, I apologize for that as I'm kind of new to coding. create table Booking ( BookingID char(4) primary key, dateBooked datetime not null, creditCard char(16) null, expiryDate datetime not null, CVC char (3) not null, confirmationID char(4) not null,

SQL BCP with column name

天涯浪子 提交于 2021-02-20 04:44:07
问题 I am trying to export my stored procedure to a .csv file using BCP. It does give me a output file in .CSV but it does not print column name. Below is the script. Please look at and let me know what i am missing DECLARE @command VARCHAR(4000) declare @fulldate varchar(30) = convert(varchar,GETDATE(),112) declare @year varchar(30) = left(@fulldate,4) declare @day varchar(30) = right(@fulldate,2) declare @month varchar(30) = left(right(@fulldate,4),2) DECLARE @FileDirectory VARCHAR(1000) = 'c:\'

Merge data depending on object and no gaps in dates

我的未来我决定 提交于 2021-02-20 04:25:05
问题 I have got in the DB data like you can see below (additional info about dates: date in valid_from is included, date in valid_to is excluded) obj_number obj_related valid_from valid_to AA BB 01.01.2018 01.01.2019 AA BB 01.01.2019 31.03.2019 AA BB 31.03.2019 AA CC 01.01.2020 30.06.2020 AA CC 02.07.2020 31.10.2020 AA CC 31.10.2020 31.12.2020 AA DD 01.01.2018 30.11.2020 AA DD 30.11.2020 31.12.2020 I have to merge the data, but in a special way. It should be merged around obj_related to show the

Postgresql slow delete from where exists

我只是一个虾纸丫 提交于 2021-02-20 04:06:39
问题 I'm having trouble with slow delete queries. I have a schema ,say "target" containing tables that all have an equivalent table (identical columns & primary keys) in another one, say "delta". I now want to delete all rows that appear in the delta schema from the target schema. I have tried this using the DELETE FROM WHERE EXISTS approach, but that seems incredibly slow. Here's an example query: DELETE FROM "target".name2phoneme WHERE EXISTS( SELECT 1 FROM delta.name2phoneme d WHERE