Can someone copyright a SQL query? [closed]

I work for a school district. Every year we have to export a list of students from our student management system and send it to a company that handles our online exams.

So to do this export, we had to hire someone who knew the inner workings of our student management system. He wrote an sql (Adaptive Sybase SQL Anywhere) query to export the students to a csv file like we needed. This was before I started working for the district, so for a while I assumed this was an actually application, until it came time for me to do the export myself.

And every year he charges us $500 to update this query to export the students for the current year. So when I discovered it was only a query (.bat file and .sql file), my thought was "I can update this myself". All I have to do is change the years in the query (eg. 2009 to 2010).

The query (.sql file) itself has this comment at the top:

// This code was writtend by [the guy]
// 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].

(Yes, it really does says "writtend".)

So now my boss is worried that we're violating the copyright. And that the guy is gonna find out that I updated the query myself because we haven't asked him to update it this year and take legal action.

So back to the subject's question: Can he really copyright this query? And if so, is modifying it ourselves a copyright violation? In my mind, a single query isn't program code. It's more a command line command. But I don't know what it's considered legally.


If I were you, I would write a full description of what the query needs to do, including all the tables, fieldnames etc., and post that here. Someone here is bound to be able to write a new version of the query that is not copyright your developer, and you can edit it each year to your hearts content.


He charges $500 to change 2009 to 2010? Oh man what a rip.

This year pay him his $500 and tell him you want the query to take the school year as a parameter. See how he reacts to knowing this will be his last time working for you.


First, the standard disclaimer: I'm not an attorney, so don't take anything I say as legal advice.

What I'm saying below is about the law in the United States -- in other countries it is likely to vary, though thanks to the Berne Convention, copyright law is fairly uniform across many countries.

Copyright can cover creative, written works, and I'd say a SQL query can/does fall within that range.

At the same time, unless his contract with the school is written quite strangely, he wrote this for them as a work for hire. In that case, his claim of copyright is probably an outright falsehood -- when a work is written for hire, the hirer, not the author, owns the copyright.

There seems to be some controversy about what constitutes a work made for hire. According to US law (17 USC, §101):

 A “work made for hire” is—

  (1) a work prepared by an employee within the scope of his or her employment;

  or

  (2) a work specially ordered or commissioned for use as a contribution to a
  collective work, as a part of a motion picture or other audiovisual work,
  as a translation, as a supplementary work, as a compilation, as an
  instructional text, as a test, as answer material for a test, or as an
  atlas, if the parties expressly agree in a written instrument signed by
  them that the work shall be considered a work made for hire.

Since this query seems to fall within the scope of '(1)', it can qualify as a work made for hire, even without an express agreement to that effect. The possible exception would be if his contract was written so it excluded writing the query from falling within the scope of his employment.

The only part that's really open to question is whether he qualifies as an employee or not. In the case of a consultant, that can be a difficult question to answer. Basically, if he work's completely independently, and just delivers a final result then he's probably not. If he works about like a normal employee, and they have control over things like his schedule and such, then there's a pretty good chance that he would qualify as just a temporary employee.