Within the OSI-Model, why is SQL considered to be a session layer "protocol"? Isn't SQL a language and not a protocol at all?
SQL includes many things (I'm skipping a few):
- the SQL syntax itself (there is a standard, just more or less applied by various databases). I believe this is what you are referring to.
- the wire protocol format (there are a few of those). This is mostly about how to represent data.
- the interaction between clients and servers. This is closely integrated with the first two.
The third one concerns session establishment, use, and close. This fits fairly well within OSI level 5.
In SQL, you can create and reuse a session. The actual statements (specific keywords and sql syntax) are using that session. So you could say that the SQL language itself is closer to layer 6, although that's debatable as well.
You could also view transactions as "sessions", but not in the networking sense.
This may sound like a vague answer, but that's because SQL covers so much that it doesn't fit neatly into one box.
Because SQL servers setup and manage sessions between clients and the server and has the concept of transactions. These are the two main functionalities that session layer services perform -- session management and synchronization points (in SQL that would be transactions):