|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Column Mean in R | |
I have loaded a dataframe in R with this code:
> sales <- read.csv2(file="d:\\downloads\\sales_data.csv", sep=",")There are a number of columns in here, one of which is "Profit". I want to get the mean value of this column. What code does this? | |
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 Order of Operations What is the result from this code? SELECT -100.0/-100.0*10.0 Answer: 0.1 Explanation: The answer is actually 0.1. The negative operator is lower precedence than the multiplication/division, so this actually executes like: SELECT -(100.0/-(100.0*10.0)) Crazy, but a good explanation from Ken Fisher. Ref: Operator Precedence - https://docs.microsoft.com/en-us/sql/t-sql/language-elements/operator-precedence-transact-sql?view=sql-server-ver15 |
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 |
SQL 2017 AOAG setup on Standalone servers - I've been trying to setup AlwaysON AG on two standalone default sql instances (SQL 2017 Enterprise Edition - 14.0.1000.169). I've checked, port numbers (1433 and 5022) on both the servers are open and there's no issue with DNS. (Hostname is not more than 15 characters.) Can anyone help me with this error please. Msg 47106, […] |
SQL replication many publishers to 1 subscriber - Hello, I am wondering, have 2 questions in regards to transaction replication... probably best to ask my question with using an example, so I have 4 servers, Server A, B, C, D, and the SQL servers A, B, and C, will be publishers, and Server D I would like to be the distributor and Subscriber, […] |
SQL Server 2016 - Administration |
SP performance tuning, any hints. - How to make the below code faster, does it help by changing updlock to nolock help, or please share if you see anything which can be improved syntax wise, etc? ------------------------------------------------------------------------------------------------- CREATE PROCEDURE [dbo].spTest(@DateToProcess DateTime, @ForceTotalRecalc bit = 0) AS SET XACT_ABORT ON SET NOCOUNT ON DECLARE EffectiveDate DATE DECLARE @LastDateProcessed DATE DECLARE @ThisDate DATE […] |
Who changed the SQL memory - is there a way to know who changed the SQL memory and when |
SQL Server 2016 - Development and T-SQL |
UTC time to EST time - Hi, The 'TIME_UTC' column is UTC timing. I would like to generate the report for EST timings . But below query gives UTC timings for the last week.I would like to convert it to EST timing. Any suggestions pls. select TIME_UTC from table_name where TIME_UTC BETWEEN cast(GETDATE()-8 as date) AND cast(GETDATE()-1 as date) Thanks. |
performance tuning for a subquery - Hey Guys I have a quick questions regarding a better way to write a query: e2 is a bigger table . I have two columns here CNTRY_ISSUE_NAME and CNTRY_ISSUE_ISO here. I would like to know if there is a better way to write that can give a performance boost to this query. These are just […] |
SQL 2012 - General |
How to generating Excel File with multi sheet by using SQL server 2012? - I need to create stored procedure or query or any thing on SQL server 2012 take data table from c# code and create Excel file with multi sheet based on data Exist on data table . From data below as Example I have Function GetDate return data table . Create File ABC.xlsx with two sheet […] |
SQL Server 2012 - T-SQL |
Sql server index - Hi Experts , I have a job which calls 100 of stored procedure. I have identified the tables which were used in the process and rebuild the fragmented index having average_fragmentation_percentage>25. But the performance of the query degraded after index rebuild operation . Can you guys tell me the possible reasons why this happened. Thanks […] |
Regex question - A developer asked me to run a query based on the following regex: ^[A-Z]{4}[0-9]{4} Which means that he wanted any row where the column in question did not have 4 alpha characters, followed by 4 numeric characters. I last played with regex about 6 years ago, so hunted around and found nothing suitable for T-SQL. […] |
how to check which tsql make increasing the log file size - Hello, We set database log file size to 10GB, however database log file size is increased to 30 GB within one day (weekend day). So we would like to see which user or tsql is making increase log file size to very fast. Is it possible to see which transaction or sql statement is increasing […] |
SQL Server 2019 - Administration |
SET DEADLOCK PRIORITY LOW question - Hey all, Session 1 = entity framework, as of not can't change anything about it Session 2 = stored proc, can control it Session 1 and 2 are deadlocking. I want 1 to be the deadlock victim. If I set 2 to have a deadlock priority LOW, will this cause 1 to be the deadlock […] |
SQL 2017 AOAG setup on Standalone servers - I've been trying to setup AlwaysON AG on two standalone default sql instances (SQL 2017 Enterprise Edition - 14.0.1000.169). I've checked, port numbers (1433 and 5022) on both the servers are open and there's no issue with DNS. (Hostname is not more than 15 characters.) Can anyone help me with this error please. Msg 47106, […] |
Attach and Detach Method vs SQL Manage object method - Hi there, if you want to detach a database you would right click on the DB->Tasks->Detach What are the motivations behind doing this? I suspect if you want to make edits to an existing database and don't want to alter the production environment. What's the difference between attaching (right click on databases -> attach) and […] |
Analysis Services |
Translate Dimension Values (multidimensional) - Hello, is there a method to translate the values of a dimension? Example: dimension called diabetic with an IS_DIABETIC column and two values YES and NO I would like to do a translation in French of the values 'OUI' and 'NON' instead of YES / NO THANKS |
COVID-19 Pandemic |
Daily Coping 8 Jun 2020 - Today’s tip is to re-frame a worry and try to find a positive way to respond. http://voiceofthedba.com/2020/06/08/daily-coping-8-june-2020/ |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |