I am using teradatasql package which native solution of Teradata as a connector between python and Teradata to load data from DB. However, I want to insert data frames I created in python back to DB. Is it possible to write data frames to the database by using teradatasql package? Thanks Answer SQLAlchemy provides the linkage between pandas dataframes and
Tag: teradata
Assigning column value based on condition on another column in sql (teradata)
I have a table which has the following columns: Date, AcctId, CustID, BackupID, Logins, Amount. For a given Date, an AcctID can more than one CustIDs, but I want to assign a singular CustID to an AcctID based on the value of Logins. i.e.: If Cust1 has more Logins than Cust2 for the given Date and AcctID then CustID should
Concatenate in sql teradata
I have the following code Sel account, Div, Modl, Sub_modl From table_1 Where Div gives me 01, Modl = 1 is CS, and Sub_modl=1. I should combine these fields to have: 01_CS_0101 Where the first 01 …
Make parent and child hierarchy with records for parents as well as children
I have a parent-child id_table hierarchy – e.g. |parent|child| |——|—–| | | 0| | 0| 1| | 0| 2| | 0| 3| | 1| 4| | 1| 5| | 2| 6| | 4| 7| | …
Single column from Multiple columns from join in SQL
I have a table output like this, which is a result of multiple table joins. I am trying to get a table like this. This is what i am doing currently doing. Not sure how to make the three columns combine to a single column. Answer If you have only one value per row — or if you just want
Delete rows where string value appears inside another row value that is larger
I am trying to make a table smaller by removing values that appear inside other larger values. e.g. Column Row1 potato234 Row2 to2 Row3 ot Row4 potatos The outcome I want is for row 2 and 3 to …
Teradata SQL help. Need help getting the start date and end date (yellow) of the most recent employment status. Thank you
Teradata SQL help. Need help getting the start date and end date (yellow) of the most recent employment status. Thank you. Click on the question for image. Answer There are several ways to get your expected result, based on your data you might apply Teradata’s NORMALIZE option, a SQL extension to combine overlapping periods: Caution : This returns a new
put a 1 if the customer has bought in 3 following months sql assistant
I’m a beginner with teradata SQL assistant and I don’t know if it can do what I need. I have a base with the variables ID, month (or period) and the incomes of that month. What I need is to put a 1 if …
Column showing revenue increasing cumulatively, then only repeats the max value after a certain date
I’m creating a dashboard that, among other things, shows how much revenue a rep generated in their first month of joining the company. This is going to be based off a table I’m creating with SQL. The simplest version of this table will be: date (which will be every day of the week), rep name, revenue generated from when they
How can I return desired record when using pivot
I am using a pivot table to return records that have been updated in the past 7 days. If account has been updated, only return contype ‘AAA’ and ‘BBB’ for the ID. Each ID can have up to 8 ‘types’. I …