Software Development Exam  >  Software Development Notes  >  SQL for Beginners  >  Assignment: Introduction to SQL Server

Assignment: Introduction to SQL Server | SQL for Beginners - Software Development PDF Download

Multiple Choice Questions (MCQs)

Q1: What is SQL Server?
(a) A programming language
(b) A database management system
(c) An operating system
(d) A cloud storage service
Ans: (b)

Q2: Which language is used to interact with SQL Server?
(a) Python
(b) Java
(c) Structured Query Language (SQL)
(d) HTML
Ans: (c)

Q3: What is the primary function of SQL Server Management Studio (SSMS)?
(a) To edit images
(b) To manage and interact with SQL Server databases
(c) To create web pages
(d) To develop mobile applications
Ans: (b)

Q4: Which of the following is NOT a type of SQL command?
(a) Data Manipulation Language (DML)
(b) Data Definition Language (DDL)
(c) Hypertext Markup Language (HTML)
(d) Data Control Language (DCL)
Ans: (c)

Q5: What is the purpose of the SELECT statement in SQL?
(a) To delete records
(b) To retrieve data from a database
(c) To create a new database
(d) To modify existing data
Ans: (b)

Q6: What does the WHERE clause do in an SQL query?
(a) Sorts data
(b) Filters records based on conditions
(c) Deletes a database
(d) Creates a table
Ans: (b)

Q7: Which of the following is an example of DML (Data Manipulation Language)?
(a) CREATE
(b) ALTER
(c) UPDATE
(d) DROP
Ans: (c)

Q8: Which function is used to return the total number of rows in an SQL table?
(a) COUNT()
(b) SUM()
(c) AVG()
(d) MAX()
Ans: (a)

Higher Order Thinking Skills (HOTS)

Q1: Write an SQL query to find duplicate records in a table named Employees based on the Email column.
Ans:

SELECT Email, COUNT(*) 
FROM Employees 
GROUP BY Email 
HAVING COUNT(*) > 1;

Q2: How would you optimize an SQL query that retrieves data from a large table with millions of rows? Provide an example.
Ans: 
Indexing and query optimization techniques can be used. Example:
CREATE INDEX idx_employee_name ON Employees(Name);
SELECT * FROM Employees WHERE Name = 'John Doe';

Q3: Write an SQL query to fetch the second highest salary from a table named Salaries.
Ans:

SELECT MAX(Salary) 
FROM Salaries 
WHERE Salary < (SELECT MAX(Salary) FROM Salaries);

Q4: How can you ensure that an UPDATE query only modifies records that meet a specific condition? Provide an example.
Ans: 
Use the WHERE clause to filter records. Example:
UPDATE Employees 
SET Salary = Salary * 1.10 
WHERE Department = 'IT';

Q5: Write an SQL query to delete duplicate records from a table while keeping one instance of each.
Ans:

DELETE FROM Employees 
WHERE ID NOT IN (
SELECT MIN(ID) 
FROM Employees 
GROUP BY Email
);

Fill in the Blanks

Q1: SQL Server is developed by Microsoft as a __________ database management system.
Ans: relational

Q2: DDL (__________) is used to define and modify database structures.
Ans: Data Definition Language

Q3: The __________ uniquely identifies each record in a table.
Ans: Primary Key

Q4: The __________ clause is used to sort query results in ascending or descending order.
Ans: ORDER BY

Q5: __________ helps eliminate data redundancy and improves database efficiency.
Ans: Normalization

True or False

1. SQL Server is an open-source database management system.
Ans: False

2. The INSERT statement is used to add new records to a database.
Ans: True

3. A primary key can contain duplicate values in a table.
Ans: False

4. The HAVING clause is used with aggregate functions to filter records.
Ans: True

5. SQL supports both relational and non-relational database structures.
Ans: False

Hands-On Questions

Q1: Write an SQL query to create a table named Students with columns ID, Name, and Age.
Ans:

CREATE TABLE Students (
    ID INT PRIMARY KEY,
    Name VARCHAR(50),
    Age INT
);

Q2: Write an SQL query to insert three records into the Students table.
Ans:

INSERT INTO Students (ID, Name, Age) VALUES
(1, 'Alice', 20),
(2, 'Bob', 22),
(3, 'Charlie', 18);

Q3: Write an SQL query to retrieve all records from the Students table where the age is greater than 18.
Ans:

SELECT * FROM Students WHERE Age > 18;

Q4: Write an SQL query to update the Name column of a student with ID 2.
Ans:
UPDATE Students SET Name = 'Robert' WHERE ID = 2;

Q5: Write an SQL query to delete all students whose age is less than 16.
Ans:
DELETE FROM Students WHERE Age < 16;

The document Assignment: Introduction to SQL Server | SQL for Beginners - Software Development is a part of the Software Development Course SQL for Beginners.
All you need of Software Development at this link: Software Development
1 videos|10 docs

FAQs on Assignment: Introduction to SQL Server - SQL for Beginners - Software Development

1. What is SQL Server and what are its primary features?
Ans.SQL Server is a relational database management system developed by Microsoft. Its primary features include support for structured query language (SQL), data storage, data retrieval, transaction processing, and security features. It also offers tools for data analysis, reporting services, integration services, and advanced analytics.
2. How do I install SQL Server on my computer?
Ans.To install SQL Server, you need to download the installation package from the official Microsoft website. After downloading, run the installer and follow the on-screen instructions. You will need to choose the edition (such as the Developer or Express edition for free use), configure server settings, and set up authentication modes before completing the installation.
3. What is the difference between SQL Server Express and SQL Server Standard editions?
Ans.SQL Server Express is a free version with limitations on database size (up to 10 GB) and resources, suitable for small applications and development environments. SQL Server Standard provides a robust set of features for medium to large businesses, including higher performance, advanced analytics, and support for larger databases and more concurrent users.
4. How can I create a database in SQL Server?
Ans.To create a database in SQL Server, you can use SQL Server Management Studio (SSMS) or write a SQL command. In SSMS, right-click on the 'Databases' node and select 'New Database'. Alternatively, you can execute a SQL command like `CREATE DATABASE YourDatabaseName;` in a query window.
5. What are some common SQL Server error messages and how can I troubleshoot them?
Ans.Common SQL Server error messages include "Login failed for user", "Cannot connect to server", and "Timeout expired". To troubleshoot these, check user permissions, verify the server name and instance, ensure SQL Server is running, and review the connection strings in your application. Checking the SQL Server error logs can also provide additional details.
Related Searches

Viva Questions

,

Assignment: Introduction to SQL Server | SQL for Beginners - Software Development

,

Exam

,

Summary

,

video lectures

,

shortcuts and tricks

,

Objective type Questions

,

practice quizzes

,

ppt

,

Extra Questions

,

study material

,

pdf

,

Previous Year Questions with Solutions

,

Assignment: Introduction to SQL Server | SQL for Beginners - Software Development

,

Assignment: Introduction to SQL Server | SQL for Beginners - Software Development

,

Semester Notes

,

mock tests for examination

,

past year papers

,

MCQs

,

Important questions

,

Sample Paper

,

Free

;