Laden...
|
|
|
|
|
|
|
Question of the Day |
Today's question (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 418 Which of these will give me count of distributions for each of the values in Age_Group? | |
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) |
The Last Sequence I create a new sequence object. CREATE SEQUENCE dbo.DecrmentByOne AS SMALLINT INCREMENT BY-1;What does this code return? SELECT NEXT VALUE FOR dbo.DecrmentByOneAnswer: 32,767 Explanation: The default value for a sequence object is the min or max of the datatype. If the object decrements, then the max value is chosen. Ref: CREATE SEQUENCE - https://docs.microsoft.com/en-us/sql/t-sql/statements/create-sequence-transact-sql?view=sql-server-ver15 |
Featured Script |
How to register SPN for SQL service account s.charaya from SQLServerCentral Check if the SPN is already registered: setspn -l domain\xxxxx If not, run below commands: setspn -A MSSQLSvc/abc.xx.companyname.com:1433 domain\xxxxx setspn -A MSSQLSvc/abc.xx.companyname.com domain\xxxxx setspn -A MSSQLSvc/abc:1433 domain\xxxxx setspn -A MSSQLSvc/ abc domain\xxxxx Verify again, setspn -l domain\xxxxx
|
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 - Administration |
Performance Tuning a SQL Server Database in Amazon RDS - Hi Team, Thanks in advance for simplifying the the people tasks by your valuable suggestions. I am being assigned a new task where in I have to analyze a SQL Server DB in Amazon RDS. I am struck with below issues. How to performance tune the Database. Can I just a take a backup and […] |
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) […] |
Using a PARTITION BY JOIN to Fill In The Gaps in Sparse Data - Hello Trying to convert an Oracle SQL which uses "partition" in Left outer join into SQL server as shown below. select v.table_name , v.program_no , v.column_name , a.creation_timestamp , a.record_key , a.before_value , a.after_value from audit_010_v v left outer join audit_data a partition by (table_name, creation_timestamp, record_key) on a.table_name = v.table_name and a.column_name = v.column_name […] |
SQL Server 2016 - Administration |
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 […] |
Is there anything in SQL Server that is analogous to Autonomous DB in Oracle? - Or is anything like that is planned to roll out in the SQL Server world? |
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 […] |
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. webmaster@sqlservercentral.com |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Laden...
Laden...
© 2024