Laden...
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
CTE in Tempdb | |
When does a CTE use tempdb? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Getting the Group Counts I have this dataframe in Python: sales.head() Date Day Month Year Customer_Age Age_Group Customer_Gender Country State Product_Category Sub_Category Product Order_Quantity Unit_Cost Unit_Price Profit Cost Revenue 0 2013-11-26 26 November 2013 19 Youth (<25) M Canada British Columbia Accessories Bike Racks Hitch Rack - 4-Bike 8 45 120 590 360 950 1 2015-11-26 26 November 2015 19 Youth (<25) M Canada British Columbia Accessories Bike Racks Hitch Rack - 4-Bike 8 45 120 590 360 950 2 2014-03-23 23 March 2014 49 Adults (35-64) M Australia New South Wales Accessories Bike Racks Hitch Rack - 4-Bike 23 45 120 1366 1035 2401 3 2016-03-23 23 March 2016 49 Adults (35-64) M Australia New South Wales Accessories Bike Racks Hitch Rack - 4-Bike 20 45 120 1188 900 2088 4 2014-05-15 15 May 2014 47 Adults (35-64) F Australia New South Wales Accessories Bike Racks Hitch Rack - 4-Bike 4 45 120 238 180 418Which of these will give me count of distributions for each of the values in Age_Group? Answer: sales["Age_Group"].value_counts() Explanation: The value_counts() method will help here. Ref: pandas.Series.value_counts() - https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.value_counts.html |
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Development |
PIVOT query - Hi I have this query using PIVOT SELECT * FROM ( SELECT a.Mun, l.Name, a.NumberOfRooms FROM Acco as a INNER JOIN look as l ON a.AccoTypeId = l.id INNER JOIN reg as r ON r.AccoId = a.Id WHERE r.RegDate IS NOT NULL AND r.RegDate <> '' and a.Mun like 'CB%' ) as t PIVOT( SUM(NumberOfRooms) […] |
SQL Server 2016 - Administration |
SQL server 2016 SP2 error - Hi All, am trying to update my 2016 SQL server instance to the SP2. the current version is Microsoft SQL Server 2016 (SP1-GDR) (KB4505219) - 13.0.4259.0 (X64) Jun 15 2019 19:20:12 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows 10 Enterprise 6.3 (Build 18363: ) SP2 setup file : SQLServer2016-KB4549825-x64.exe for some […] |
SQL Trace Not Capturing Database Events....EXEC, INSERT, UPDATE... - I want to see what Stored Procedures are run when users enter data in a 3rd party product we use. I would also like to see INSERTS & UPDATES to tables. I set up a trace that I have used elsewhere with success, but in this case, it's not capturing any of the events I […] |
SSRS "My Subscriptions" Fails to Load if TLSv1.0 Is Disabled on the Server - We have noticed in the past that if we disable TLSv1.0 in HKey_Local_Machine\System\CurrentControlSet\Control\SecurityProviders \SCHANNEL\Protocols\TLS 1.0\Server\Enabled (set to 0), most functionality still works in SSRS, but "My Subscriptions" fails to load, giving the not-very-descriptive error: "An error has occured. Something went wrong. Please try again later." Upon changing the setting to 1, "My Subsriptions" works as […] |
SQL Server authentication - I see my sql server is NTLM authentication enabled. I am looking to connect using my mac pro laptop now and I am not able to connect to sql servers as they use windows authentication without kerberos so I can't connect from non windows machines. I am thinking to use sql account instead of enabling […] |
adding a Select statement to an existing table - I have this table abc. when I script it out it contains Create table and Alter procedure commands. Now I want to add a Select statement to this table, so when I script out the next time it should consist of Create table, Alter procedure and the new Select statement Is there a way to […] |
SQL Server 2016 - Development and T-SQL |
In general how do you know which fields to join on between 2 tables? - I know this is a broad question. I have 2 tables (no primary/foreign keys). In general, with 2 tables, how do you know which fields to join on and who many fields do you use? From what I understand, the more fields you join on the more narrow you are making your data. But do […] |
Comparing 2 large tables row by row and date comparision - We have a functionality where in we need to process a large file containing around 1.5 million rows. We insert the data from the file in a secondary table and once this insert is complete, we compare it with our parent table and only insert rows which have changed. The parent table contains around 2.5 […] |
Project EVERYTHING is assigned to me. Can I measure Everything via T-SQL? How? - Is it reasonable to roll-up ALL metrics from Query Store to measure 'everything'? and then compare 1 sp (input param, SP name) metrics with 'Everything else' on server (or should it be by db?) one stored proc watch is easy via Query Store. But aggregating ALL THE REST ('Everything') for even just one day is […] |
SQL Server 2019 - Development |
Extracting a Date Properly from a String. - If i have a string of the following format master_20200613220000.bak Then How do i display the Date as 2020-06-13 22:00:00.000 Please Help. |
Hi all, just registered with SQLServerCentral. - Hi all, I am looking for some one to join me in learning and developing a small project. I have some background on MS Sql Server 2012. If there is some one there with a project or we could find one and learn together, please let. I believe the best way to learn quickly is […] |
Two Strings compare using t-sql - Declare @Intstr1 varchar(100) Declare @Intstr2 varchar(100) Set @Intstr1 = '1,2,3,4,5,6,7,8,9' -- This will NOT contain duplicates Set @Intstr2 = '4,6,6,7,7' -- This string may have duplicates but surely exists in str1 Need a t-sql for finding numbers from Str1 which are NOT in Str2 Please help. Expected output.. @output = '1,2,3,5,8,9' |
General |
ISNULL clause with a condition - Hi, I've got the following code to select the period where I have active data: { FIXED : MAX(IF NOT (ISNULL([Qty in tn])) THEN [Period] END)} The problem I have is that the Qty in tn is only null when another column [Data Type] = ACT. How do I modify the above code to take […] |
Anything that is NOT about SQL! |
SSC Traffic Declining ? - Are there fewer posts & replies on SSC these days ? It seems like it. Or are they just spread over more sub forums of the various SQL versions ? |
COVID-19 Pandemic |
Daily Coping 15 Jun 2020 - Today’s tip is to find a joyful way of being physically active (indoors or out). http://voiceofthedba.com/2020/06/15/daily-coping-15-june-2020/ |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. [email protected] |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Laden...
Laden...