CREST Practitioner Security Analyst (CPSA) Practice

Disable ads (and more) with a membership for a one time $2.99 payment

Master the CREST Practitioner Security Analyst Exam. Prepare with quizzes and comprehensive study guides that include tips and explanations. Excel in your certification journey!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which SQL command lists the database names in MS-SQL?

  1. SELECT name FROM master..sysdatabases

  2. SELECT username FROM pg_user

  3. SELECT * FROM information_schema.columns

  4. SELECT name FROM sysobjects

The correct answer is: SELECT name FROM master..sysdatabases

The command that correctly lists the database names in MS-SQL is the one that queries the `master` database and accesses the `sysdatabases` system view. This view contains information about all the databases available in the SQL Server instance. By executing the command `SELECT name FROM master..sysdatabases`, the user retrieves the names of all databases, which is exactly what is required to list them. Other options refer to different databases or metadata. For example, querying `pg_user` pertains to PostgreSQL and retrieves information about users, which is not relevant for listing databases in MS-SQL. The query against `information_schema.columns` fetches details about columns in tables across databases, but does not list the databases themselves. Lastly, `sysobjects` is a system view that contains information about various database objects but does not specifically provide a list of databases. Thus, the first choice is the only one that aligns with the objective of listing database names in MS-SQL.