Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

1.

<html>
<head>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
height: 100vh;
}

header {
background-color: #333;
color: #fff;
text-align: center;
padding: 10px;
}

main {
display: flex;
flex: 1;
}

nav {
width: 200px;
background-color: #f0f0f0;
padding: 10px;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

nav a {
display: block;
margin-bottom: 10px;
text-decoration: none;
color: #333;
}

article {
flex: 1;
padding: 20px;
}
</style>
</head>
<body>

<header>
<h1>Company Name</h1>
</header>

<main>
<nav>
<a href="#" onclick="showDepartment('department1')">Department 1</a>
<a href="#" onclick="showDepartment('department2')">Department 2</a>
<a href="#" onclick="showDepartment('department3')">Department 3</a>
<!-- Add more departments as needed -->
</nav>
<article id="department-info">
<!-- Department information will be displayed here -->
</article>
</main>

<script>
function showDepartment(department) {
const departmentInfo = getDepartmentInfo(department);

document.getElementById('department-info').innerHTML = departmentInfo;
}

function getDepartmentInfo(department) {
const departmentData = {
department1: 'Information for Department 1',
department2: 'Information for Department 2',
department3: 'Information for Department 3',
};

return departmentData[department] || 'Department information not available.';


}
</script>

</body>
</html>

2.

//product collection
db.Product.insert({"_id": 1,"name": "Laptop","price": 800,"quantityInStock": 10})
db.Product.insert({"_id": 2,"name": "Smartphone","price": 500,"quantityInStock":
20})

//customer collection
db.Customer.insert({"_id": 1,"name": "Mr. Rajiv","email": "rajiv@example.com"})
db.Customer.insert({"_id": 2,"name": "Ms. Priya","email": "priya@example.com"})

//Order collection
db.Order.insert({"_id": 1,"customer": 1,"products": [{"productId": 1, "quantity":
2},{"productId": 2, "quantity": 1}],
"orderValue": 2100,"processed": true})

db.Order.insert({"_id": 2,"customer": 2,"products": [{"productId": 2, "quantity":


3}],
"orderValue": 1500,"processed": false})

//invoice collection
db.Invoice.insert({"_id": 1,"order": 1,"amountPaid": 2100,"paymentDate":
ISODate("2023-01-10T00:00:00Z")})

a.List all products in the inventory.


db.Product.find({})

b.List the details of orders with a value >20000.


db.Order.find({ "orderValue": { $gt: 20000 } })

c.List all the orders which has not been processed (invoice not generated)
db.Order.find({ "processed": false })
d.List all the orders along with their invoice for “Mr. Rajiv”.

You might also like