dml

String/INT96 to Datatime - Amazon Athena/SQL - DDL/DML

喜欢而已 提交于 2020-01-25 09:06:08
问题 I have hosted my data on S3 Bucket in parquet format and i am trying to access it using Athena. I can see i can successfully access the hosted table. I detected something fishy when i try to access a column "createdon". createdon is a timestamp column and it reflects same on Athena table, but when i try to query it using the provided SQL below query SELECT createdon FROM "uat-raw"."opportunity" limit 10; Unexpected output : +51140-02-21 19:00:00.000 +51140-02-21 21:46:40.000 +51140-02-22 00

String/INT96 to Datatime - Amazon Athena/SQL - DDL/DML

萝らか妹 提交于 2020-01-25 09:04:16
问题 I have hosted my data on S3 Bucket in parquet format and i am trying to access it using Athena. I can see i can successfully access the hosted table. I detected something fishy when i try to access a column "createdon". createdon is a timestamp column and it reflects same on Athena table, but when i try to query it using the provided SQL below query SELECT createdon FROM "uat-raw"."opportunity" limit 10; Unexpected output : +51140-02-21 19:00:00.000 +51140-02-21 21:46:40.000 +51140-02-22 00

SQL Trigger on Update, Insert, Delete on non-specific row, column, or table

我怕爱的太早我们不能终老 提交于 2020-01-24 21:50:53
问题 I have several databases that are used by several applications (one of which is our own, the others we have no control over in what they do). Out software has to know when the database has last been changed. For reasons I won't get into to keep this short we decided that going with a new table per database that has a singular field: last_changed_on that has a GetDate() as a value. This way our own software can check when it was last changed and check it to the date it has stored for said

SQL Server TOP(1) with distinct

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-23 01:16:27
问题 I am trying to extract the first row I get after ordering the result by i_version_id . If I do not use TOP(2) , my query works as expected ans returns all results sorted by i_version_id. But when I add the TOP(2) (as shown below), it says that there is a syntax error near distinct . Please let me know what I am doing wrong. SELECT TOP(2) distinct(i_version_id) FROM [PaymentGateway_2006].[dbo].[merchant] WHERE dt_updated_datetime > '2013-11-11' GROUP BY i_version_id ORDER BY i_version_id; 回答1:

sql combine rows with same date

徘徊边缘 提交于 2020-01-16 19:00:27
问题 I want to combine rows when they have same date and Item# while aggregating received QTY and Outstanding QTY. Also, PO# should be combined with “, “. Please refer to the image or table below. Thank you in advance!! This is my SQL Query... SELECT * from [mason01].[dbo].[po_east] as t1 inner join (select distinct [Date],[ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding] FROM [mason01].[dbo].[po_east] group by [Date], [ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding]) as t2 on t1.Date

sql combine rows with same date

倾然丶 夕夏残阳落幕 提交于 2020-01-16 19:00:11
问题 I want to combine rows when they have same date and Item# while aggregating received QTY and Outstanding QTY. Also, PO# should be combined with “, “. Please refer to the image or table below. Thank you in advance!! This is my SQL Query... SELECT * from [mason01].[dbo].[po_east] as t1 inner join (select distinct [Date],[ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding] FROM [mason01].[dbo].[po_east] group by [Date], [ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding]) as t2 on t1.Date

How to enter new line using sql command INSERT

僤鯓⒐⒋嵵緔 提交于 2020-01-15 06:55:46
问题 Q: I wanna to know the syntax of SQL query of inserting new line in my table. I mean ,I wanna to enter the following in my table abc : aaaaaaaaaa bbbbbbbbbb cccccccccccc Maintaining the new line.through INSERT command . Thanks in advance 回答1: When I answered this question, you'd got it tagged with SQL Server 2008. You've since edited it to be about Informix. The following works for SQL Server 2008. INSERT INTO MyTable(MyField) VALUES('AAAAA' + CHAR(13) + CHAR(10) + 'BBBBB') Informix looks

How can Delete be both a DDL and a DML statement

杀马特。学长 韩版系。学妹 提交于 2020-01-14 14:05:13
问题 I am currently reading the offical Microsoft book 'Database Administration Fundamentals' in preparation to sitting it's exam. I understand what DDL and DML are but Microsoft show DELETE as being both a DDL and DML statement. I have googled this but I cannot anything that confirms or denies this. A good reference to this is the question: What is DDL and DML Which shows it as a DML. Below is the segments from the book: Data Manipulation Language (DML) is the language element that allows you to

How can Delete be both a DDL and a DML statement

£可爱£侵袭症+ 提交于 2020-01-14 14:04:38
问题 I am currently reading the offical Microsoft book 'Database Administration Fundamentals' in preparation to sitting it's exam. I understand what DDL and DML are but Microsoft show DELETE as being both a DDL and DML statement. I have googled this but I cannot anything that confirms or denies this. A good reference to this is the question: What is DDL and DML Which shows it as a DML. Below is the segments from the book: Data Manipulation Language (DML) is the language element that allows you to

Oracle - How does Oracle manage transaction specific DML statements

六月ゝ 毕业季﹏ 提交于 2020-01-11 10:49:26
问题 Imagine I have this simple table: Table Name: Table1 Columns: Col1 NUMBER (Primary Key) Col2 NUMBER If I insert a record into Table1 with no commit... INSERT INTO Table1 (Col1, Col2) Values (100, 1234); How does Oracle know that this next INSERT statement violates the PK constraint, since nothing has yet been committed to the database yet. INSERT INTO Table1 (Col1, Col2) Values (100, 5678); Where/how does Oracle manage the transactions so that it knows I'm violating the constraint when I