Skip to main content

What is a user in SQL?

A user in SQL is an account that has access to a database and performs actions in it (queries, changes, administration).

Every user has:

  • a name (login),
  • a password,
  • a set of privileges that define what they're allowed to do.

Example of creating a user

sql
CREATE USER manager WITH PASSWORD '12345';

After that, you can grant privileges:

sql
GRANT SELECT, INSERT ON employees TO manager;

Now the manager user can read and add data to the employees table, but can't delete or change its structure.

So a user is an identified subject through which the DBMS controls who can do what in the database.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

What is a user in SQL?: SQL Interview Question