11-20 câu SQL
10 Questions
10 Views

11-20 câu SQL

Created by
@BuoyantOakland8071

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

  1. (0.150 Points) What is a stored procedure?

  • A set of SQL statements stored and executed as a single entity. (correct)
  • B. A process for data export/import.
  • C. Data stored in a database.
  • D. All of the above
    1. (0.150 Point) Determine the error in the below SELECT statement SELECT ename, deptno, sal FROM emp WHERE job-CLERK;

  • A. WHERE clause cannot refer the column JOB since it doesn't appears in the SELECT column list
  • B. Character literal CLERK must be enclosed within single quotes (correct)
  • C. Character literal CLERK must be enclosed within parentheses
  • D. No error in the query
    1. (0.150 Point) A table TEST_COUNT has 10 number values as 3, 32, 1, 1, null, 24, 12, null, 32, null. Predict the output of the below query. SELECT COUNT (*) FROM test_count;

  • A. 7
  • B. 6
  • C. 10 (correct)
  • D. Throws exception because COUNT function doesn't works with NULL values
    1. (0.150 Point) Which SQL statement inserts data into a table called Projects?

    <p>B. INSERT INTO Projects (ProjectName, ProjectDescription) VALUES ('Content Development', 'Webske content development project')</p> Signup and view all the answers

    1. (0.150 Point) The LIKE SQL keyword is used along with...

    <p>B. WHERE clause.</p> Signup and view all the answers

    1. (0.150 Point) Why use a DBMS?

    <p>D. All of the above</p> Signup and view all the answers

    1. (0.150 Point) Which SQL statement selects all rows from table called Contest, with column ContestDate having values greater or equal to May 25, 2006?

    <p>B. SELECT FROM Contest WHERE ContestDate &gt; 05/25/2006</p> Signup and view all the answers

    1. (0.150 Point) Consider the following schema: SUPPLIERS(SupplierID, SupplierName, Address) Which SQL statement is used to REVOKE ALL privilege on the SUPPLIERS in the schema to the user 'Manager'?

    <p>A. REVOKE ALL ON SUPPLIERS FROM Manager</p> Signup and view all the answers

    19, (0.150 Point) What is an index?

    <p>A. An index is an internal table structure that SQL Server uses to provide quick access to rows of a table based on the values of one or more columns</p> Signup and view all the answers

    1. (0.150 Point) Which of the following is one of the basic types of joins in DB?

    <p>D. All of the above</p> Signup and view all the answers

    Study Notes

    Stored Procedure

    • Pre-compiled set of SQL statements
    • Stored in the database
    • Can be executed by name

    SQL Statement Error

    • job-CLERK should be job='CLERK'
    • Comparison operator = needs to be used
    • Quotes are needed to enclose the string value

    Count in SQL

    • COUNT(*) function returns the number of rows in the table even if they contain null values
    • In this case, the output will be 10

    SQL INSERT Statement

    • INSERT INTO statement is used to add new rows to the table

    LIKE Keyword

    • The LIKE keyword is used with wildcard characters (%) or underscore (_) to match patterns in data

    Using a Database Management System

    • To manage data effectively
    • To ensure data integrity
    • To control access to data
    • To improve performance and security

    SQL SELECT Statement

    • SELECT * FROM Contest WHERE ContestDate >= '2006-05-25'
    • Date should be in the format YYYY-MM-DD

    REVOKE Privilege

    • REVOKE ALL ON SUPPLIERS FROM Manager;
    • This will remove all privileges from the Manager user on the SUPPLIERS table

    Database Index

    • An index is a data structure that helps to speed up data retrieval
    • It stores the values of one or more columns in a sorted order
    • Used to create efficient search conditions

    Join Types

    • Inner Join
    • Left Join
    • Right Join
    • Full Join

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    This quiz explores what stored procedures are in the context of database management. Participants will learn their definition, purpose, and how they contribute to efficient database operations. Test your knowledge about stored procedures and their applications.

    More Like This

    [04/Vienne/07]
    29 questions

    [04/Vienne/07]

    InestimableRhodolite avatar
    InestimableRhodolite
    MySQL Subqueries and Stored Procedures Quiz
    12 questions
    Benefits of Stored Procedures in SQL
    16 questions
    Use Quizgecko on...
    Browser
    Browser