SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

The Voice of the DBA

Ensuring Designs have Flexibility

One of the biggest complaints from developers about RDBMSs is that they are inflexible and hard to change. This has led to many developers in the past using existing fields for a variety of purposes, sometimes putting data from multiple places into one field. In more recent times, this has led to adding or migrating data to new data stores, with the idea that the system can adapt easily to changing requirements.

I ran across a post on system flexibility that somewhat illustrates the issue. The writing is a little hard to understand, but the author is thinking about the process of ordering food and how a system might need to handle some of the exceptions or additional changes. While the employees in a store might deal with this in an ad hoc manner, those of us building software need to think through the possible issues and account for (at least) some of them in code.

Software typically has much more flexibility than we do at the database level, since anyone building software is usually building on top of the database system. However, those of us that design schemas need to ensure that we take care to consider the different ways that our data store will serve the needs of the end user and design in the proper structures needed to support the data that will be stored.

In my experience, it's important for the database developer to question the requirements of the customer. Just as a software developer might try and tease out additional features and functions that are needed, the database developer needs to carefully query the customer to ensure that there won't be additional data that the customer assumes is being captured. We need to be aware of relationships and cardinality between the data elements, in order to better design a system that meets the current, and potential future, needs.

Building and designing a database isn't that hard, but it does take some attention to detail and a meticulous nature to think through how some real world situation is modeled. While I think small, frequent DevOps releases are a way to move forward, I'd also like to ensure that we capture as much detail as early as possible to minimize disruptions. After all, refactoring and changing the schema is harder in a database system than in an application software class.

Steve Jones from SQLServerCentral.com

Join the debate, and respond to today's editorial on the forums


The Voice of the DBA Podcast

Listen to the MP3 Audio ( 3.3MB) podcast or subscribe to the feed at iTunes and Libsyn. feed

The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

ADVERTISEMENT
GDPR

How to make your SQL Server development GDPR ready

Redgate’s SQL Data Privacy Suite helps you to build a data catalog of your SQL Server estate, and put in processes to protect and monitor personal information. Find out more about how our tools help with GDPR compliance

Database DevOps

Benchmark your Database DevOps maturity level

Get a better understanding of how advanced your current processes are, receive recommendations for improvements, and see how your maturity level compares with that of your peers. Complete the Database DevOps Maturity Assessment

Featured Contents

 

Getting started with SQL 2019 big data cluster in Azure

Blesson John from SQLServerCentral.com

Installing and connecting to SQL 2019 big data cluster More »


 

Saving Data to Various Formats, Using SQL

Additional Articles from SimpleTalk

You have many options when exporting data from a database. In this article, Phil Factor compares several methods including XML and array-in-array JSON for speed and file size. More »


 

Using T-SQL to Fix Bad Data in XML Documents Using FLWOR

Additional Articles from MSSQLTips.com

Learn how to use T-SQL to fix contents of an XML document using FLWOR More »


 

From the SQLServerCentral Blogs - PowerShell to Simulate Load

Grant Fritchey from SQLServerCentral Blogs

Gathering metrics is quite difficult if there are no queries. So, if you’re working in non-production environments, but you still... More »


 

From the SQLServerCentral Blogs - Introducing ChaosLoad

Gavin Draper from SQLServerCentral Blogs

Scripted Simulation of SQL Server Loads When blogging, presenting or testing an idea, one issue I constantly have is that my... More »

Question of the Day

Today's Question (by Steve Jones):

If I run this code in SQL Server 2017, what happens?

 CREATE TABLE dbo.SalesOrderHeader ( OrderKey INT IDENTITY(1, -1) , CustomerName VARCHAR(30) ) GO INSERT dbo.SalesOrderHeader (CustomerName) VALUES ('Andy') INSERT dbo.SalesOrderHeader (CustomerName) VALUES ('Brian') INSERT dbo.SalesOrderHeader (CustomerName) VALUES ('Steve') GO SELECT * FROM dbo.SalesOrderHeader AS soh GO 

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 1 point in this category: IDENTITY Property.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

Pro Power BI Desktop

This book shows how to deliver eye-catching Business Intelligence with Microsoft Power BI Desktop. You can now take data from virtually any source and use it to produce stunning dashboards and compelling reports that will seize your audience’s attention. Slice and dice the data with remarkable ease then add metrics and KPIs to project the insights that create your competitive advantage.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

I have a data set of statistics from the completed 2018 NFL season. The data set looks like:

 > head(nfl2018.qb) Rk Player Tm Age Pos G GS QBrec Cmpâ.. Att CompPrcnt Yds TD 1 1 Ben Roethlisberger\\RoetBe00 PIT 36 QB 16 16 9-6-1 452 675 67.0 5129 34 2 2 Andrew Luck\\LuckAn00 IND 29 QB 16 16 10-6-0 430 639 67.3 4593 39 3 3 Kirk Cousins\\CousKi00 MIN 30 QB 16 16 8-7-1 425 606 70.1 4298 30 4 4 Matt Ryan\\RyanMa00 ATL 33 QB 16 16 7-9-0 422 608 69.4 4924 35 5 5 Patrick Mahomes*\\MahoPa00 KAN 23 QB 16 16 12-4-0 383 580 66.0 5097 50 6 6 Derek Carr\\CarrDe02 OAK 27 QB 16 16 4-12-0 381 553 68.9 4049 19 TD. Int Int. Lng Y.A AY.A Y.C Y.G Rate QBR Sk Yds.1 NY.A ANY.A Sk. X4QC GWD 1 5.0 16 2.4 97 7.6 7.5 11.3 320.6 96.5 73.0 24 166 7.10 7.04 3.4 2 3 2 6.1 15 2.3 68 7.2 7.4 10.7 287.1 98.7 71.5 18 134 6.79 6.95 2.7 3 3 3 5.0 10 1.7 75 7.1 7.3 10.1 268.6 99.7 60.6 40 262 6.25 6.48 6.2 1 0 4 5.8 7 1.2 75 8.1 8.7 11.7 307.8 108.1 70.6 42 296 7.12 7.71 6.5 1 1 5 8.6 12 2.1 89 8.8 9.6 13.3 318.6 113.8 82.0 26 171 8.13 8.89 4.3 2 2 6 3.4 10 1.8 66 7.3 7.2 10.6 253.1 93.9 49.3 51 299 6.21 6.09 8.4 3 3 

I want to get a list of the player names, teams, and attempts (Att) that have a CompPrcnt greater than or equal to 100. What command would help me here?

Answer: nfl2018.qb[nfl2018.qb$CompPrcnt>=100,c(2,3,10)]

Explanation:

To filter a set of rows out of the data frame, we want to use the df[] syntax, using criteria for the rows in the place before the comma. In this case, we would use:

 nfl2018.qb$CompPrcnt>=100 

This gives us all rows where the CompPrcnt >= 100, our criteria. However, we only want the player name, team, and attempts. To get these columns only, we need a vector of columns. In this case, c(2,3,10) gives us these columns.

Ref:  Filtering a dataframe - click here

Filtering Data - click here


» Discuss this question and answer on the forums

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 : SQL Server 2017 - Administration

Error restoring 2016 onto 2017 - Setup: SourceBox = SQL 2016, 10 databases, all use TDE, all compat mode 130.  Backups done using Ola scripts, each written to...

Error in add listener - Hello everyone I show a problem for the creation of listen under my avaiblity GroupI made this query sql server ALTER...

SQL AG Upgrade - Hi, I am looking for an advice.I am planning an AG upgrades to 2017.I read in many places that I should...


SQL Server 2017 : SQL Server 2017 - Development

T-SQL Multiple Rows into One Row - I have the following rows UserShiftID  RowID  StartDateTime

split text into rows: The maximum recursion 100 has been exhausted before statement completion - I have a function that splits text with a comma as separator into rows. I used to do this with a...

Finding Average/Day for Each Month? - I have a massive data set which breaks down how many trips were taken on which days of which months...


SQL Server 2016 : SQL Server 2016 - Administration

Session stuck in killed\roll back - One of the session that is executing a stored proc from an application is stuck in the killed\rollback phase. Arguably,...

SQL 2016 Azure VM and restoring from Storage Account - Hi I have deployed SQL 2016 Enterprise in Azure IaaS. I created a VM and installed SQL 2016 onto. For backups...

Cannot bring the Windows Server Failover Clustering (WSFC) resource (ID '38e4748b-1b06-4017-9c3a-e7eb3f45cb2c') online (Error code 5018). - I am getting below error messages...granted the sysadmin to the respective login and granted the privileges but still getting below...


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Importing from XML to SQL 2014 - This is my 4th day on SQL so I am a newbie. I created a query to import from an...


SQL Server 2014 : Administration - SQL Server 2014

Database refresh from Production DB to Test DB in Sql server 2014 - Hello, I would like to know the what's the best way i can do Database refresh from Production DB to Test DB...


SQL Server 2014 : Development - SQL Server 2014

Let SQL do the work ? - Long time reader, 1st time poster here. I'm trying to build a stored procedure that creates a table that looks...

How do I insert into a table that only has a single (identity) column? - I have a table with only 1 column "fldID". That column is a primary key (to ensure uniqueness), identity column...


SQL Server 2012 : SQL 2012 - General

cte Coding... Need the case statement to get this to work - Hello, I had a cte query that is working.  We need to reset the date every August.  So, the cte coding...


Reporting Services : Reporting Services

Second SSRS URL Not Working - I have a SSRS 2017 installation that is working fine using the default URL (eg http://<servername>/Reports). There are no problems...


Programming : Powershell

Run New PowerShell Process As A Different User - Hello, I'm trying to create a PowerShell script that will run a new PowerShell Process as a different 'Windows' user.  The following code seems...


Database Design : Design Ideas and Questions

Entity Framework & RowVersion - Hi all, One of our developers has put a rowversion field with the datatype timestamp into all of the tables of...


SQL Server 2005 : Administering

Transaction Log File size not reducing after transaction log backups - Hi all, I've seen this topic discussed a million times in various blog posts and forum posts, but I still can't...


SQL Server 2005 : T-SQL (SS2K5)

Remove DATE ONLY from datetime column - Hello, I need to remove DATE from a date time column in SQL 2005? All I keep finding on Google is...


Career : Events

The SQL Saturday Thread - As popular as SQL Saturday is, I'm surprised that nobody created a thread dedicated to SQL Saturday, so I created...

This email has been sent to newsletter@newslettercollector.com. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com