SQL Intermediate Assessment PDF

Summary

This is a SQL intermediate assessment with multiple-choice questions. It covers SQL commands for manipulating databases and tables.

Full Transcript

1/14/25, 8:39 PM SQL Intermediate Assessment Assessment Name - SQL Intermediate Assessment ATTEMPTS LEFT : 1 TAKE ASSESSMENT (HTTPS://WINGZ.ITVEDANT.COM/INDEX.PHP/ASSIGNMENT-TEST-STUDENT/RETAKE-TEST?ID=15713...

1/14/25, 8:39 PM SQL Intermediate Assessment Assessment Name - SQL Intermediate Assessment ATTEMPTS LEFT : 1 TAKE ASSESSMENT (HTTPS://WINGZ.ITVEDANT.COM/INDEX.PHP/ASSIGNMENT-TEST-STUDENT/RETAKE-TEST?ID=157136) Total Questions - 50 Score - (43 / 50) 86% 1) statement to change table name is _______ 1M A) change B) change name C) modify D) rename 2) command used to see table schema 1M A) desc tablename B) describe tablename C) both of the above D) none of the above 3) Which is the subset of SQL commands used to manipulate Database structures, including tables? 1M A) Data Definition Language(DDL) B) Data Manipulation Language(DML) C) DML and DDL D) None of the Mentioned 4) Which of the following is/are the DDL statements? A) Create 1M B) Drop C) Alter D) All of the Mentioned 5) To delete a particular column in a relation the command used is: A) UPDATE TABLE 1M B) TRUNCATE COLUMN C) ALTER , DROP D) DELETE COLUMN 6) Which statement would add a column CGPA to a already defined table Student 0M https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 1/9 1/14/25, 8:39 PM SQL Intermediate Assessment A) ALTER TABLE Student ADD COLUMN (CGPA NUMBER(3,1)); B) ALTER TABLE Student CGPA NUMBER(3,1); C) ALTER TABLE Student ADD (CGPA NUMBER(3,1)); D) Both A and C 7) Which among the following is the correct syntax for showing all tables in the database? 1M A) SHOWS TABLES; B) SHOW TABLE; C) SHOW; D) SHOW TABLES; 8) What is the command to delete database? 1M A) delete database databasename; B) drop database database name; C) remove database databasename; D) all of the above 9) What does the following statement in SQL do? DROP TABLE student; 1M A) Deletes a table called student B) Creates a table called student C) Check if there is a table called student D) None of the above 10) Which statement is TRUE about the WHERE Clause? A) In order to retrieve rows, WHERE Clause is used. 1M B) In order to group the rows, WHERE Clause is used. C) In order to select the defined groups, WHERE Clause is used. D) In order to return the rows, WHERE Clause is used. 11) Which statement is TRUE about the GROUP BY Clause? A) In order to retrieve rows, GROUP BY Clause is used. 1M B) In order to group the rows that share the same property, GROUP BY Clause is used. C) In order to select the defined groups, GROUP BY Clause is used. D) In order to return the rows, GROUP BY Clause is used. 12) Which statement is TRUE about the ORDER BY Clause? A) In order to return the rows in a specific order, ORDER BY Clause is used. 1M B) In order to group the rows, ORDER BY Clause is used. C) In order to select the defined groups, ORDER BY Clause is used. D) None of the above 13) The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate. A) Where, from 1M https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 2/9 1/14/25, 8:39 PM SQL Intermediate Assessment B) From, select C) Select, from D) From, where 14) Which Clause is used to sort the stored data in alphabetical order? 1M A) MODIFY B) ALTER C) ORDER by CLAUSE D) UPDATE 15) Which of the following is the correct order of a SQL statement? 1M A) SELECT, GROUP BY, WHERE, HAVING B) SELECT, WHERE, GROUP BY, HAVING C) SELECT, HAVING, WHERE, GROUP BY D) SELECT, WHERE, HAVING, GROUP BY 16) Which among the following will insert data into only name and mark columns in student table (consider total 4 columns are there in student table) A) insert into student ("abc",70); 1M B) insert into student values ("abc",70); C) insert into student name,mark values ("abc",70); D) insert into student (name,mark) values ("abc",70); 17) Which Of the SQL Statements Is Correct? 1M A) DELETE * from user WHERE Username = 'user1' B) DELETE from user WHERE Username = 'user1' C) DELETE user1 from user WHERE Username = 'user1' D) All of the above 18) Which of the following columns in a table cannot be updated? A) DATE type columns in the table 1M B) Columns which allows NULL values in the table C) A primary key column which also serves as foreign key reference in another table D) All of the above 19) Which of the following is not included in DML (Data Manipulation Language)? A) Insert 1M B) Update C) Delete D) Alter 20) What is xyz in the following SQL statement? https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 3/9 1/14/25, 8:39 PM SQL Intermediate Assessment DELETE FROM xyz WHERE abc = 5; A) column name 1M B) table name C) row name D) database name 21) In the following MySQL command how many rows will be updated? UPDATE person SET lname='s', Fname = 'p', WHERE person_id = 1; A) Single row 1M B) Double row C) No row D) None of the mentioned 22) In which of the following cases a DML statement is not executed? 1M A) When existing rows are modified B) When a table is deleted C) When some rows are deleted D) All of the above 23) If we want to filter or restrict some rows from the output produced by GROUP BY then we use _________ clause A) FILTER 1M B) WHERE C) HAVING D) JOIN 24) ______________ function returns current date and time. A) sysdate() 1M B) now() https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 4/9 1/14/25, 8:39 PM SQL Intermediate Assessment C) getdate() D) all of the above 25) What does AVG() function returns? A) First value of the column 1M B) Last value of the column C) Sum of rows of the table D) Average value of the column 26) What does COUNT() function returns? A) Average value 1M B) Largest value C) Smallest value D) Number of rows 27) We can use literal in the CONCAT function. What does literal refer to? A) Number 0M B) Character C) Date D) All of the above 28) The SQL statement: SELECT Name, COUNT(*) FROM NAME_TABLE; counts the number of name rows and displays this total in a table with a single row and a single column. A) True 0M B) False C) - D) - 29) 'COUNT' keyword belongs to which categories in Mysql? 1M A) Aggregate functions B) Operators C) Clauses D) All of the mentioned 30) What will be output of following code SELECT SUBSTR("QWERTY",2,4) A) WER 1M B) WERT C) WERTY D) ERTY 31) Which among the following is used with date_format() to get abbreviated month name ? 1M https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 5/9 1/14/25, 8:39 PM SQL Intermediate Assessment A) %a B) %b C) %m D) %M 32) _________ clause is used to join tables where the column names don't match in both tables 1M A) USING B) ON C) CLUB D) IS 33) _____ is a join of every row of one table to every row of another table 0M A) FULL JOIN B) INNER JOIN C) CROSS JOIN D) SELF JOIN 34) Which join refers to join records from the right table that have no matching key in the left table are include in the result set: A) Left join 1M B) Right join C) inner join D) None of the above 35) Relation R1 has 10 tuples and 5 attributes. Relation R2 has 0 tuples and 7 attributes. When a CROSS JOIN is achieved between R1 and R2, how many tuples would the resultant set have? A) 28 1M B) 10 C) 0 D) 35 36) In inner join, result is produced by matching rows in one table with rows in another table. A) True 1M B) False C) - D) - 37) Which of the following syntax is used to create a view in Mysql? A) create view view_name select statement. 0M B) create view view_name as select statement. https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 6/9 1/14/25, 8:39 PM SQL Intermediate Assessment C) create view_name view as select statement. D) create view viewname. 38) Consider the following view: Create view dept as select empid,name,post from company. Relation or table company has the following attributes: empid,name,post,city,salary. For the query “insert into dept(empid,name,post)values(112,’Harry’,’Admin’);” What are the values of the attributes city and salary in the relation(table) company. a. A) NOT NULL 0M B) NULL C) 0 D) Error statement 39) Views are not updatable. A) True 1M B) False C) - D) - 40) Which statement is TRUE about the WHERE Clause? A) In order to retrieve rows, WHERE Clause is used. 1M B) In order to group the rows, WHERE Clause is used. C) In order to select the defined groups, WHERE Clause is used. D) In order to return the rows, WHERE Clause is used. 41) Which statement is TRUE about the GROUP BY Clause? A) In order to retrieve rows, GROUP BY Clause is used. 1M B) In order to group the rows that share the same property, GROUP BY Clause is used. C) In order to select the defined groups, GROUP BY Clause is used. D) In order to return the rows, GROUP BY Clause is used. 42) In order to sort the records according to the columns, which clause is used? A) HAVING 1M B) GROUP BY C) ORDER BY D) None of the above 43) By default, sorting by ORDER BY clause is done in which order? https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 7/9 1/14/25, 8:39 PM SQL Intermediate Assessment A) Ascending 1M B) Descending C) - D) - 44) The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate. A) Where, from 1M B) From, select C) Select, from D) From, where 45) The query given below will not give an error. Which one of the following has to be replaced to get the desired output? SELECT ID, name, dept name, salary * 1.1 WHERE instructor; A) Salary*1.1 1M B) ID C) Where D) Instructor 46) Find the cities name with the condition and temperature from table 'weather' where condition = sunny or cloudy but temperature >= 60 1M A) SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy' AND condition = 'sunny' OR temperature >= 60 B) SELECT city, temperature, condition FROM weather WHERE condition = 'cloudy' OR condition = 'sunny' OR temperature >= 60 C) SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' OR condition = 'cloudy' AND temperature >= 60 D) SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' AND condition = 'cloudy' AND temperature >= 60 47) Which Clause is used to select a particular row from the set of row in an existing table? 1 M A) WHERE B) FROM C) ALTER D) None of the mentioned 48) Which statement is used to get all data from the student table whose name starts with p? 1M A) SELECT * FROM student WHERE name LIKE '%p%'; B) SELECT * FROM student WHERE name LIKE 'p%'; C) SELECT * FROM student WHERE name LIKE '_p%'; https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 8/9 1/14/25, 8:39 PM SQL Intermediate Assessment D) SELECT * FROM student WHERE name LIKE '%p'; 49) The wildcard in a WHERE clause is useful when? 1M A) An exact match is necessary in a SELECT statement B) An exact match is not possible in a SELECT statement C) An exact match is necessary in a CREATE statement D) An exact match is not possible in a CREATE statement 50) The SQL keyword(s) _________ is used with wildcards. 1M A) LIKE only B) IN only C) NOT IN only D) IN and NOT IN https://wingz.itvedant.com/index.php/assignment-test-student/exam-view-topic?id=9624&isMax=1 9/9

Use Quizgecko on...
Browser
Browser