Window functions of SQl server are very useful. Many webpage like this one https://www.brentozar.com/sql-syntax-examples/window-function-examples-sql-server/ have written how to use them. I want to share with you one segment of my sql code to get running total percentage using window functions.
It worked finally. My 12 queries was now 1 query. I only need to run it once to give my result. Yeah!
What did I do to make it work? I made an extra layer. First layer, select the result set as before. Then, select these result set and add rowID. Thirdly, select second layer result set by joining RowID.
I have twelve queries. Each of the query select 20 random account numbers that fits its own special where clauses. For twelve times, I need to copy the SQL code in TOAD, run the query in DB2, copy paste the 20 lines of result to one final excel file, which contains twelve columns.
Of course, I want to change it. I think it should not be too difficult.
Continue reading “query result side by side? NO!”
My kids and I love tongue twisters. We say tongue twister loudly in the car and they giggle and laugh loudly. I love to hear them giggle and laugh.
As I work full time as a SQL developer, I write and read SQL code much more often than when I was a SQL blogger. When I see SQL some code, I think: this is good. But, can you find a better way? Furthermore, what is the best way? These questions tickle my brain and when I find some answer, my brain giggles and laughs. I love that feeling.
Today, I want to share two SQL brain twisters (that comes from my work) with you. Continue reading “Brain Twister in SQL”
I found this serial posts about Power BI Q&A:
All these three posts make perfect sense for a SQL developer, who, just same as Power BI Q&A, is happy to work with well-designed, normalized tables (this thought makes me terrified. who am I? A real intelligence or an artificial one?) Continue reading “AI and BI – Part 2”
As part of my effort to explore AI, I need to deeper my knowledge of multi-dimensional data model, I take this Udemy course: SQL Server Analysis Services – SSAS, Data Mining and Analytics.
It is a pretty good course, with a lot of good examples of MDX query. As a person with SQL background, I feel that for a machine (or AI), MDX is easier to write than SQL because how to join tables are skipped in MDX. I guess, Power BI Q&A translate natural language questions to MDX, not SQL. I will find out that later.
Come back to the course, I recommend it to anyone who is interested in learning SSAS.
Immediately after Xbox 1X was on the market, the price of Xbox 1S dropped dramatically. However, my son only wanted the newest model. It was OK for him not to have an Xbox at all, but it was not acceptable for him to have an older version of Xbox. I am in the same group with my son. I prefer to play the newest toy too. Excitedly, I announce my newest project: using AI (Artificial Intelligence) to answer BI (Business Intelligence) questions. Continue reading “AI and BI – Part 1”
As I am learning Cosmos DB and writing blog posts about it at the same time, future topics flood in for my future blogs, like “Data Bricks in 7 days”, “Maximize free 7 day training trial by Pragmatic Works”, “Learning Machine Learning in 7 days”, “R and Power BI Series” and so on. While my ideas are going more quickly than my time can let me work on, I want to encourage you to start establish your personal brand by blogging. I find that blogging is more rewarding than I expected. Continue reading “Blogging and Personal Branding”
A few weeks ago, SpaceX’s rocket launch made into headlines. I am wandering, when Elon Musk first thought about learning about rocket, what goals were in his mind. If what he had had in his mind were like “Let me see whether we can use this technology to light up backyard BBQ burner from 10 yard away”, He would had missed the glorious moment of Falcon 9.
At the end of my third day, with a little knowledge of what Cosmos DB is, and how to add and query data from Azure portal and web app, I am asking myself these following questions: What I want to learn about next? Are they right goals? Can I achieve them? Am I getting myself closer to outer space or my backyard BBQ oven?
The more Cosmos DB documentation I read, the more excited I get. I feel like I am inside of a huge amusement park. There are lots of things I can play and want to play (like import and query data). There are also things that I don’t have ability to play yet, like MongoDB and Graph API. After I read this page, I even have a park-hop ticket in hand, like hopping into Azure web app development. Continue reading “Learn Azure Cosmos DB in 7 days (3)”