0% found this document useful (0 votes)
49 views

SQL Queries For Practical

The document provides a series of SQL statements and instructions to: 1) Create tables to store customer, order, employee, department, and student data with the appropriate fields and data types. 2) Establish relationships between tables using primary and foreign keys. 3) Generate forms and queries to view, add, update and delete records in the tables. 4) Create reports to display related data from multiple tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

SQL Queries For Practical

The document provides a series of SQL statements and instructions to: 1) Create tables to store customer, order, employee, department, and student data with the appropriate fields and data types. 2) Establish relationships between tables using primary and foreign keys. 3) Generate forms and queries to view, add, update and delete records in the tables. 4) Create reports to display related data from multiple tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Create a table called "Customers" with the fields "CustomerID",


"FirstName", "LastName", "Email", "PhoneNumber", and "Address".
2. Assign appropriate data types to each field in the "Customers" table.
3. Sort the records in the "Customers" table by last name in ascending order.
4. Create a table called "Orders" with the fields "OrderID", "OrderDate",
"CustomerID", and "TotalPrice". Assign appropriate data types to each field.
5. Create a relationship between the "Customers" table and the "Orders" table
using the "CustomerID" field as the primary key in the "Customers" table
and as the foreign key in the "Orders" table.
6. Create a form called "Customer Form" using the wizard, based on the
"Customers" table.
7. Navigate through the records in the "Customer Form".
8. Use the "Customer Form" to add, delete or modify a record in the
"Customers" table.
9. Create a query that selects all records from the "Orders" table where the
"TotalPrice" is greater than $100.
10.Write a SQL statement that updates the "PhoneNumber" field in the
"Customers" table for the record with "CustomerID" equal to 1.
11.Write a SQL statement that deletes all records from the "Orders" table where
the "OrderDate" is before January 1st, 2023.
12.Write a SQL statement that appends a new record to the "Customers" table
with the values "CustomerID" = 100, "FirstName" = "John", "LastName" =
"Doe", "Email" = "[email protected]", "PhoneNumber" = "555-5555",
and "Address" = "123 Main St".
13.Use the wizard to create a report based on the "Orders" table.
14.View and print the report you created in step 13.
15.Write an SQL query to create a table named "students" with the following
columns: id (integer), name (text), age (integer), and grade (text).
16.Write an SQL query to add a new column named "address" to the "students"
table with a data type of text.
17.Write an SQL query to sort the records in the "students" table by the "name"
column in ascending order.
18.Write an SQL query to create a new table named "grades" with columns
named "id" and "grade". Add a primary key to the "id" column and set it to
auto-increment.
19.Write an SQL query to create a form that displays the "name" and "age"
fields from the "students" table.
20.Write an SQL query to navigate to the next record in the "students" form.
21.Write an SQL query to delete a record from the "students" table where the
"id" is equal to 1.
22.Write an SQL query to update the "grade" of a student with an "id" of 2 to
"B+".
23.Write an SQL query to select all records from the "students" table where the
"age" is greater than 18.
24.Write an SQL query to append a new record to the "students" table with a
name of "John" and an age of 21.
25.Write an SQL query to view a report that shows the average age of students
grouped by their grade.
26.Create a table named "Employees" with the following fields: EmployeeID,
FirstName, LastName, Email, Phone, and HireDate. Use Design View to
create the table.
27.Add a new field to the "Employees" table named "Salary" with the
appropriate data type.
28.Sort the records in the "Employees" table by the "LastName" field in
ascending order.
29.Create a new table named "Departments" with the following fields:
DepartmentID and DepartmentName. Use the Wizard to create the table.
30.Create a simple form for the "Employees" table using the Wizard.
31.Navigate to the last record in the "Employees" form.
32.Add a new record to the "Employees" table using the form.
33.Write a simple query to select all records from the "Employees" table.
34.Write a simple SQL query to create a new table named "Customers" with the
following fields: CustomerID, FirstName, LastName, Email, and Phone.
35.Create a report for the "Employees" table using the Wizard.
36.Create a table called "Employees" with the following fields: EmployeeID
(autonumber, primary key), FirstName (text), LastName (text), and HireDate
(date/time).
37.Add a new field called "DepartmentID" to the Employees table with a data
type of number.
38.Sort the records in the Employees table by HireDate in ascending order.
39.Create a new table called "Departments" with the following fields:
DepartmentID (autonumber, primary key), DepartmentName (text), and
ManagerID (number, foreign key referencing the EmployeeID field in the
Employees table).
40.Create a form using the Employees table that displays all fields and allows
the user to navigate through the records.
41.Modify the form to include a subform that displays the related records from
the Departments table for each employee.
42.Add a button to the form that allows the user to add a new employee record.
43.Create a query that selects all employees hired in the last 30 days and sorts
them by LastName.
44.Write a SQL statement that creates a new table called "Projects" with the
following fields: ProjectID (autonumber, primary key), ProjectName (text),
and EmployeeID (number, foreign key referencing the EmployeeID field in
the Employees table).
45.Create a report using the Projects table that shows the project name,
employee name, and hire date for each employee working on a project.
46.Preview and print the report, making sure it is formatted correctly and
displays all necessary information.
47.

You might also like