https://github.com/ghazaleze/mydatabaselab
IUT database lab, SQL
https://github.com/ghazaleze/mydatabaselab
sql-server-management-studio tsql
Last synced: 3 months ago
JSON representation
IUT database lab, SQL
- Host: GitHub
- URL: https://github.com/ghazaleze/mydatabaselab
- Owner: GhazaleZe
- Created: 2020-04-14T09:02:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-08T18:03:52.000Z (over 5 years ago)
- Last Synced: 2025-02-23T15:14:27.503Z (over 1 year ago)
- Topics: sql-server-management-studio, tsql
- Language: TSQL
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MyDataBaseLab :smiley:
> I'm passing this database lab from home because of COVID-19 :mask:.
> I wish good health for people all over the world :heart:
> If you have a question or idea, check the [Discussions](https://github.com/GhazaleZe/MyDataBaseLab/discussions/1)
## Requirements:
- I'm using **Microsoft SQL Server** and **Visual Studio Code** on Ubuntu and **Microsoft SQL Server Management Studio 18** on windows for this lab.
- I worked on **adventure worker 2012** database that is available [in this link](https://github.com/microsoft/sql-server-samples/releases).
## Lab1:
This session contains 2 questions. Question 1 just asked for creating 7 tables concerning primary keys and foreign keys. Question 2 has 3 parts:
- Part1: A **select** which displays *Department* information of a student whose student number is **"123"**.
- Part2: A **select** for adding 1 to all grades.
- Part3: A **select** which displays students that didn't take "DB".
## Lab2 :sleepy: :
> adventure worker 2012
This session contains 5 questions.
1. A query to select all orders with these conditions:
- TotalDue is between 100000 and 500000
- The order is from France or a country in North America.
-Status is 5
2. A query to select information on each product that's clear in the .sql file.
3. A query to display a territory that has the most sale for each product.
4. A query for creating a table named *NAmerica_Sales*:
- has the same view of question1
- only insert records from North America
- add a column to this table that can only get values: "High", "Mid", "Low"
- fill the above column with comparing Due of each product with average(clear in .sql)
5. Queries for increasing the salary of the employees and give them a Level concerning their salaries.
## Lab3 :
1.
- Create a Server Login.
- Create a role named Role1.
- Add the Role1 to the log in you've created earlier.
- With the created login go into SQL Server and create a table in AdventureWorks2012 database; then insert some data to it and read from it.
2.
- In the AdventureWorks2012 database create a user with Role2 that has the permission of security admin.
- Give Role2 the permission of reading.
## Lab4 :wink: :
> adventure worker 2012
1. Run the first query in the lab4 file and explain in detail that what the last column in the result is.
2. A query to demonstrate **sales count** and **total sales** for each territory and its region. Furthermore, calculate **sales count** and **total sales** for all territories in each region; finally for all regions.

3. A query to demonstrate **sales count** and **total sales** for each subcategory of the products and its group. Finally, it has records for demonstrating the count and values of all subcategories in each specific group.

## Support:
Reach out to me at ghazalze@yahoo.com.