Can You Copyright An SQL Query?
from the welcome-to-the-modern-world-of-ownership dept
Reader JohnForDummies alerts us to yet another example of extreme "ownership culture" found in a Stack Overflow query from a guy who works in IT for a school district. The school district needed to export a list of all its students every year to send to a company that handles their online exams -- and for years (before this guy was hired in IT), the district had contracted out the process to a guy who charged them $500 per year, to basically write and then run an SQL query that exported the data. Each year, all he had to do was change the date, but he still charged them $500. So the IT guy figures that he can change the date himself, but noticed that the contractor had put a nice copyright notice in the file:// This code was writtend by [the guy]The Stack Overflow community basically suggested that the best course of action is to rewrite the query (even potentially asking the Stack Overflow community via a separate entry, with the details of what the query needs to do), but it does raise some basic questions about whether or not an SQL query can be covered by copyright. The answer, tragically, might be more complicated than it needs to be, but assuming that the query wasn't anything really out of the ordinary, it's difficult to see how a single SQL query, by itself, would be considered unique enough to be covered by copyright. However, I'm sure there will be differences of opinion here, so let's see if any of our copyright lawyer readership would like to weigh in on this one... As for the IT folks, it would be interesting to see what people think of the idea of copyrighting a single SQL query for something like this.
// and is the property of [his company]...Copyright 2005,2006,2008,2009
// This code MAY NOT BE USED without the expressed written consent of
// [his company].
Thank you for reading this Techdirt post. With so many things competing for everyone’s attention these days, we really appreciate you giving us your time. We work hard every day to put quality content out there for our community.
Techdirt is one of the few remaining truly independent media outlets. We do not have a giant corporation behind us, and we rely heavily on our community to support us, in an age when advertisers are increasingly uninterested in sponsoring small, independent sites — especially a site like ours that is unwilling to pull punches in its reporting and analysis.
While other websites have resorted to paywalls, registration requirements, and increasingly annoying/intrusive advertising, we have always kept Techdirt open and available to anyone. But in order to continue doing so, we need your support. We offer a variety of ways for our readers to support us, from direct donations to special subscriptions and cool merchandise — and every little bit helps. Thank you.
–The Techdirt Team
Reader Comments
Subscribe: RSS
View by: Time | Thread
[ link to this | view in chronology ]
legally
Oh, and facts aren't copyrightable, no? Thus, how can a SQL query be anything but a fact to a point.
[ link to this | view in chronology ]
Re: legally
Wouldn't modifying be a derivative work?!?!
[ link to this | view in chronology ]
Re: Re: legally
Not if the original piece of information is not a work protected by copyright.
[ link to this | view in chronology ]
Re: Re: Re: legally
[ link to this | view in chronology ]
Re: Re: legally
[ link to this | view in chronology ]
Re: legally
it is called "merger doctrine."
[ link to this | view in chronology ]
ENOUGH
im serious if it were MS would make a program otmake every known possible query and POOF no more free mysql
and then the gpl2 guys would be suing MS for infringing on the USE and distribution of a gpl2 work
YOU CANT COPYRIGHT IT NERDS , IT ALREAD HAS A LISCENCE
GPLv2
[ link to this | view in chronology ]
Re: ENOUGH
[ link to this | view in chronology ]
Re: Re: ENOUGH
If you write a routine to produce every conceivable SQL query and GPL2 each one of the routines. Problem solved... or rather thats my intepretation of that caffine or alcohol based rant...
[ link to this | view in chronology ]
For the answer, be sure to ask the right question
[ link to this | view in chronology ]
Re: For the answer, be sure to ask the right question
[ link to this | view in chronology ]
Isn't code copyrighted?
How is this different from an sql query?
[ link to this | view in chronology ]
Re: Isn't code copyrighted?
Way to miss the point of the discussion, jimbo.
[ link to this | view in chronology ]
Re: Re: Isn't code copyrighted?
[ link to this | view in chronology ]
The Pro-IP whinefest
[ link to this | view in chronology ]
Re: The Pro-IP whinefest
[ link to this | view in chronology ]
Airplane-over-the-headTard(tm)
OH yes! Because the copyright of the ENTIRE CODE OUTPUT of your ENTIRE COMPANY is the equivalent of a SINGLE LINE of SQL code! Right! How could we be so foolish as to be discussing this at all?
'Tard
[ link to this | view in chronology ]
FROM Pointless.Legal entitlement
WHERE net_societal_gain = 0
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
Re:
Unclosed quotation mark before the character string 's_time
FROM Pointless.Legal entitlement
WHERE net_societal_gain = 0
[ link to this | view in chronology ]
Re: Re:
FROM Pointless.'Legal entitlement'
WHERE Pointless.'Legal entitlement'.net_societal_gain = 0
Just goes to show that there really is only ONE way using SQL get specific data from a specific database in a specific format. Once that way is copyrighted, all databases EVERYWHERE are rendered useless.
[ link to this | view in chronology ]
Re: Re: Re:
SELECT pointless.waste_of_everyones_time
FROM legal_entitlement pointless
WHERE pointless.net_societal_gain = 0;
Try this on for size, semi colon optional depending on the tool you're using. In this instance I chose to use an underscore to replace spaces in the field names. Otherwise you might use square brackets around field names that contain spaces.
Did I just violate the copyright (if any) of the original query or does this count as a derivative work?
[ link to this | view in chronology ]
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
Re:
Having written some doosies in my time, believe me I'd LOVE to be paid $500 every time someone ran the query, but that's just not how it works. Otherwise, all databases would become prohibitively expensive to run and therefore useless.
[ link to this | view in chronology ]
work for hire?
[ link to this | view in chronology ]
Re: work for hire?
[ link to this | view in chronology ]
Re: work for hire?
The code was developed with money from the customer and our own company so they had joint ownership.
The customer could use it for anything they wanted, but we had the rights to sell the code.
It still had copyright notices in there, but the customer didn't have to pay any attention to them as long as they weren't selling it.
[ link to this | view in chronology ]
Re: work for hire?
[ link to this | view in chronology ]
Re: Re: work for hire?
See, generally, 17 USC 101, 17 USC 204, Aalmuhammed v. Lee.
[ link to this | view in chronology ]
Re: work for hire?
[ link to this | view in chronology ]
The biggest question is: If I have a sql select statement "SELECT * FROM students"(basically the simplest select query I can think of), which means "get all data in table students", and declared a copyright on it, what am I copyrighting? If Susie's table just so happens to be "students" then she is now in violation. You can't make an original sql statement. Everything is built off a statement from somewhere else(I get alot of my complicated ones from the MYSQL user docs).
I would have to agree with Shawn up top and completely ignore the copyright notice and then delete it.
This does bring up another question though: what are other software copyright's covering? Without being able to see the code how do I know my snippet of code that runs a loop over a config file isn't an exact copy of another person's code? It isn't impossible to imagine that quick and easy ways to do somethings in a programming language are going to be pretty obvious to anyone working on a program in said language. things to ponder...
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
Re: Re:
[ link to this | view in chronology ]
;
[ link to this | view in chronology ]
merger doctrine
no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery,
regardless of the form in which it is described, explained, illustrated, or embodied in such work.”
Under Section 102(b), the expression of the idea is protected, not the idea itself.
Copyright law has a closely related rule called the “merger doctrine,” which states that where an idea and its expression are inseparable (an idea that can be expressed in only one way) then there can be no copyright protection for the expression.
For example, Robert Johnson is entitled to a copyright on Kindhearted Woman Blues (his expression of the 12-bar blues idea), but not on the 12-bar blues itself.
In the case of an SQL query, I think it would be very difficult to obtain copyright protection for this query, which merely appears to select a recordset and export it. However ... if in fact there are many ways to select a recordset and this programmer's code expressed an original way of doing so, then maybe it is a closer case.
[ link to this | view in chronology ]
I wasnt going to comment, but
First off, I know I shouldnt feed the trolls, but "every known possible query" is an infinite set. Thats computation theory, SQL is a language, its capable of doing a lot (or at least all the real world implementations of it).
Secondly. "is the equivalent of a SINGLE LINE of SQL code!" I havent seen any indication that this is one line of code. From the stack overflow comments it appeared that they IT guy was afraid to copy any of it based on the copyright notice. Ive seen data exports that take 5 seconds to write "select * from table_name" and Ive seen ones that take 100 hours, where the data needs to be formatted in some ridiculous manner, and there are massive tables of information and the database has been created without reasonable keys, just an example of minor things that could take time to overcome.
Basically the question I would ask comes down to is similar to an above post "Is a single SQL query sufficiently creative to be copyrighted? " but replacing the a with this. Is this query significantly complicated. In that post the point of "if a reasonbly competent DBA would come up with the same query" it shouldnt be copyrightable. But, anybody who has ever spent money on a database expert knows that their fees are generally ludicrous (although the real experts are fine tuning things based on oracle internals to shave off milliseconds in ridiculous ways).
Thirdly, this is most likely just a business decision. It is possible that the company spent more than 500 dollars of resources the first year trying to get this export working to the school's standards, and that the school refused to pay the overage charges, and as a way to recoup in subsequent years the company simply continued to bill 500 each year. I dont know, but I think this is entirely possible and it makes the actions less evil and more an attempt at getting back to even on the transaction.
[ link to this | view in chronology ]
Re: I wasnt going to comment, but
Most likely they said we will pay you $500.00 to write this code. They don't care if it takes 10 seconds or 200 hours they're paying you to get it down by a certain date. If you can't do it for that price you're an idiot to accept the work.
[ link to this | view in chronology ]
no way
[ link to this | view in chronology ]
Re: no way
[ link to this | view in chronology ]
[ link to this | view in chronology ]
another IT folk weighing in...
If we were talking database schemas I would be more inclined to yes. Still database queries and schemas aren't really great products on their own. So copyright of them would be mostly bullshit IMO. Sell complete product then copyright.
The author of the said query was performing a service...can you copyright that??? Ugh.
[ link to this | view in chronology ]
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
It's just a series of commands/strings/parameters in a row.
[ link to this | view in chronology ]
Copyright law
If you sign a work contract or are employed to produce creative works, you will have trouble asserting a separate copyright contract against your employer for works created while "on the clock" and with company resources. However, this doesn't mean that your copyright is not still there. I have signed these types of contracts in order to hand over copyright on certain very specific things, so that implies that without the contract, I could still lay claim to those things. (It almost certainly wouldn't be worth the legal costs unless millions of my money were at stake).
Copyright does not mean that someone can write "select *" (this is not a valid SQL query anyhow) as this would likely fall under the exemption made for titles. Just as you cannot copyright the title to a book, you probably cannot assert a copyright over a single, uncreative sentence. Yes, creativity is objective enough that in any legal case, some "crappy" poem will still hold up as "creative" while "select *" will not. The purpose of copyright is not to prevent anyone from using some phrase (that's a trademark) but foremost copyright is to protect published works that are generating lots of money from being ripped off and stolen from their creators, with no compensation to the creator for their work.
Copyright doesn't apply to creatively "transformed works", especially if attribution is already given and the transformations noted. So, if you take a massive SQL query and have to apply a creative new fix to it for something, your new version qualifies for its own copyright separate from the original copyright. That's right, now there are two copyrights: the one for the original author on the original work, and your new copyright on the "creatively transformed work". Creative transformation only applies in the case of a reasonable-sized transformation, meaning you can't just paraphrase someone, that's still plagiarism.
http://www.copyright.gov/
[ link to this | view in chronology ]
Re: Copyright law
No, it is not. The purpose of copyright is to promote the creation of new works. Ensuring monopoly reproduction rights is the means by which it (supposedly) does so.
[ link to this | view in chronology ]
Brilliant!
[ link to this | view in chronology ]
This is in their EULA:
"3. COPYRIGHT AND OWNERSHIP. The Program is owned by Sybase, its subsidiaries or their suppliers and are protected by copyright laws and international treaty provisions. You acquire only the non-exclusive right to use the Program as permitted herein and do not acquire any rights of ownership in the Program or any other implied rights or licenses under any intellectual property rights of Sybase."
So he didn't OWN the SQL code to copyright it, correct? He was just 'licensed to use it'. If I would interpret that right.
[ link to this | view in chronology ]
Re:
[ link to this | view in chronology ]
Copyright, work for hire, and SQL
Also, the programmer doesn't own or have claim to have use of the fieldnames, tablenames or any other part of the database. So, he can't copyright those parts of his code. ..Even if he weren't working as work for hire but had created a code package to sell to the company.
Additionally, SQL code is limited by it's rules of syntax. Much as titles of books cannot be copyrighted, a code module is probably not copyrightable because there may be only one to a few ways to efficiently phrase a routine. One might be able to copyright a program, in total. But not be able to copyright a component piece.
[ link to this | view in chronology ]
[ link to this | view in chronology ]
Why shouldn't SQL be copyrightable?
It's code meant to be compiled/parsed and executed by a computer. By the same logic as some here *NO* code can be under copyright protection (including GPL code). To be honest, it's pretty silly, but depends on the script in question.
If it's a fairly simple select statement, than no way... if it's a set of commands, and/or a sproc, then who knows. It's pretty gray afaik. And probably depends on the structure itself.
[ link to this | view in chronology ]
But who owns the SQL statement?
[ link to this | view in chronology ]
Re: But who owns the SQL statement?
(Sorry, I read through the comments on Stack Overflow after I posted this)
[ link to this | view in chronology ]
Actually, the code is poorly written, and for the price of $500, the guy who wrote it should be told to make the date field easy to change legally, or they will replace the code outright.
He's being greedy, that isn't the intent of copyright, but it is also whoever hired him's fault for not fixing this one years (and about $3000) ago.
[ link to this | view in chronology ]
Can't copyright facts...or math?
As SQL is a methodology for doing set-theory (mathematics), you'd basically be copyrighting facts.
Just because a company *says* (or *thinks*) it has a copyright on something doesn't make it so. That sounds like typical IT boilerplate, left for the sole purpose of intimidation.
To quote an un-remembered CS Professor: Plagiarism is for English Class.
The point being that the "art" of Programming is being able to see how all the bits fit together and interoperate, not the exact code. Anyone can C-C-P their way through code, but a real Programmer knows the how's and why's.
[ link to this | view in chronology ]
Re: Can't copyright facts...or math?
[ link to this | view in chronology ]
Copyright?
[ link to this | view in chronology ]
[ link to this | view in chronology ]
[ link to this | view in chronology ]
yes and no
[ link to this | view in chronology ]
What Question
where is the difference but where is the sense? It is a pickle no doubt about that.
[ link to this | view in chronology ]
Re: What Question
a select statement means "Give me X from Y where Z=A"
That is not a question. It can be worded as a question, but the sql statement itself is a statement.
All in all, I do think that you can copyright a SQL, but you shouldn't. It is not like you could enforce your copyright anyway, most of the time, sql statements are completely hidden from the user, and unless this guy/company wants to go toe to toe with oracle, microsoft, or sun, they could never get any money from their "copyright".
So yes, a SQL statement is copyright-able, but that doesn't mean a damned thing in the real world.
[ link to this | view in chronology ]
SELECT * FROM public.*
Every other query ever to be written will be a derivative work and will require payment of licence fees.
[ link to this | view in chronology ]
SQL Is A Programming Language
Since it’s a programming language, instruction sequences you write in it are no more or less copyrightable than instruction sequences written in any other language. Like any other language, you can write short, trivial things in it, and you can write long, complicated things in it.
for entry in SQLIter
(
"select clients.client_id as client_id, jobs.job_id as job_id,"
" clients.name as client_name, jobs.description as description, hours.from_time as from_time,"
" hours.to_time as to_time, hours.notes as notes from"
" clients inner join jobs on clients.client_id = jobs.client_id inner join hours on jobs.job_id = hours.job_id where"
" hours.from_time >= %(after)u and hours.from_time hours.from_time < %(before)u and hours.to_time is not null"
%
{
"after" : day_local_start(when_worked),
"before" : day_local_start(when_worked + 1),
},
) :
...
[ link to this | view in chronology ]
With respect to the first, then, the Software Freedom Law Center opines:
With the standard for originality so minimal, it's likely that this query (even if simple) is copyrightable. Either way, although without the query we can't say for sure, one of two things is likely to be true:
1. The query was so dirt-simple that there was basically no other way to do it, and therefore might be unoriginal and thus uncopyrightable; or
2. The query was complex enough to be original and copyrightable.
In the case of #1, if you were at all interested in just solving the problem, you would close the query and rewrite it yourself from scratch in the ten seconds it took to do so. If you were especially paranoid, you would call or email your buddy (i.e., anybody who has more than five minutes' experience with a database) and have him or her write the query for you cleanroom-style, to avoid any possible appearance of impropriety.
Since the original poster did not do this, it's unclear that #1 is the case. In the case of #2, then, you would pull the guy's employment contract and see what the provisions were with respect to work-for-hire. Maybe the development of the query was work-for-hire, in which case you have no problem. Maybe you got a non-exclusive license to use the code and create derivative works, in which case you still don't have a problem.
Maybe, however, whoever wrote the contract just let the contractor keep his code, with the licensing terms left out, unclear, or imprecisely stated. In this case, you first go find whomever wrote the contract and beat them about the head and neck. Then, you do one of the following:
- Rewrite the query yourself from scratch.
- If more paranoid, pay your buddy to write you a clean-room implementation of the (more complex) code as work for hire.
- Change the code and use it anyway, claiming fair use.
- Renegotiate the license with the original contractor.
[ link to this | view in chronology ]
Re:
In other contexts (usually free speech ones with companies attempting to ban distribution of things like DeCSS), you will see the idea of "code is speech". Just as some written speech is too trivial to be effectively copyrighted, so it is with code. But once the complexity and originality reaches a certain level, then claiming copyright is justifiable.
The difference between this and patents (and the reason it doesn't outrage most programmers anywhere near as much) is that with copyright, independent invention *is* permitted, so onerous licensing terms (such as these) are vulnerable to being undercut by a "clean room" reimplementation. As Dr Strange notes though, it may be a bit legally questionable getting someone that has seen the original query to do the reimplementation - from a legal point of view, it would be safer to get an untainted programmer to do it (although $500 a year isn't enough money to justify much of a lawsuit, so it may not be worth worrying about that).
[ link to this | view in chronology ]
[ link to this | view in chronology ]
Wow. I just went back to 1999!
When the internet started taking off, this type of thing was so commonplace. People thought, incorrectly, they could "copyright" software. I can't count the number of times I saw a copyright notice.
To those who think you can copyright software, a caveat warning before you rush to say "Hell ya!": 100% of the learning you received was by code someone else wrote which, for the most part, you did not pay for.
Google allows open access to anyone who takes the time to teach others how to code.
Now, those articles are copyright, but certainly not the code examples within them.
But I digress, here. I know people will challenge this because they feel they're entitled to more money than the salary they're being paid to write the code to begin with.
I can see why the "codewriters" feel this way, given songwriters carry the same "boo hoo" tune when others make more off their "hard work" (laughable) than their salary did.
Salary. Interesting word that never appears when discussing copyright. Why is that?
[ link to this | view in chronology ]
Re: Wow. I just went back to 1999!
[ link to this | view in chronology ]
Thanks, Doc, & My Look at the Practical
[ link to this | view in chronology ]
As a programmer
I would rather IP laws stay far away from the computer field. It is a nice and growing field. The more IP laws enter it, anywhere at all, the more the system slows down. Its appalling.
[ link to this | view in chronology ]
SQL query to solve Sodoku
OTOH, writing:
SELECT * FROM Students WHERE someDate > ?
Is not very creative. Probably not creative enough to qualify for copyright. Purely functional in nature. Even devoid of actual creativity.
Using two extremes it can be argued that a SQL query should definitely be copyrightable, or should definitely not be copyrightable.
The real question is whether there is anything there to copyright. Any creativity. Since we (apparently) don't know what the actual SQL query looks like, it's hard to argue whether it should be copyrightable.
As for SQL being different from other computer code, I don't see how? SQL is non-procedural and declarative to be sure. (Although modern SQL implementations allow procedural programming.) Other programming languages are also declarative, such as Prolog or various rules or expert systems. It still can take significant human creativity to write a page of code, even in SQL.
Without the actual query involved, how can we argue whether it is copyrightable? In my opinion, if the query is similar to what I wrote above, I would take the position that it is devoid of creativity and not copyrightable.
[ link to this | view in chronology ]
Silly
[ link to this | view in chronology ]
[ link to this | view in chronology ]
Reengineer using clean room techniques...
1) You have the output file from previous years.
2) You have the DB schema.
3) Write the darn query from scratch without referencing the "copyrighted" query.
3a) If you believe you are "contaminated" because you read the original "copyrighted" query, pay a local grad student $250 to write the query with a work-for-hire contract.
Now you can delete the original query and proceed.
Doug
[ link to this | view in chronology ]
Some Copyright Applies
[ link to this | view in chronology ]