Database
Database
Work Done: Downloaded and installed MySQL, set up a local server, and created an initial user.
sql
Copy code
CREATE DATABASE student_management;
Activity: Create tables and define proper data types for each field.
sql
Copy code
USE student_management;
sql
Copy code
INSERT INTO students (first_name, last_name, age, gender, department, admission_date)
VALUES
('John', 'Doe', 20, 'Male', 'Computer Science', '2023-09-01'),
('Jane', 'Smith', 22, 'Female', 'Mechanical Engineering', '2023-08-15');
sql
Copy code
SELECT * FROM students;
sql
Copy code
SELECT * FROM students
WHERE department = 'Computer Science';
sql
Copy code
UPDATE students
SET age = 21
WHERE student_id = 1;
Activity: Write a DELETE query to remove specific records from the table.
sql
Copy code
DELETE FROM students
WHERE student_id = 2;
Work Done: Created a new courses table and joined it with the students table.
sql
Copy code
CREATE TABLE courses (
course_id INT AUTO_INCREMENT PRIMARY KEY,
course_name VARCHAR(100)
);
sql
Copy code
SELECT COUNT(*) AS total_students
FROM students;
Activity: Use GROUP BY to group data and HAVING for conditional filtering.
Work Done: Grouped students by department and counted the number of students in each.
sql
Copy code
SELECT department, COUNT(*) AS num_students
FROM students
GROUP BY department
HAVING num_students > 1;
Work Done: Used a subquery to find students in departments with more than one student.
sql
Copy code
SELECT * FROM students
WHERE department IN (
SELECT department
FROM students
GROUP BY department
HAVING COUNT(*) > 1
);
Work Done: Ensured that primary keys and foreign keys are correctly set in tables.
sql
Copy code
-- Already set PRIMARY KEY and FOREIGN KEY while creating tables:
-- PRIMARY KEY on student_id, course_id in students and courses
-- FOREIGN KEY in enrollments for student_id and course_id
bash
Copy code
mysqldump -u root -p student_management > student_management_backup.sql
Activity: Create a final project for managing students using SQL queries.
sql
Copy code
-- Insert more students, courses, and enrollments
-- Write queries to view and manage data: listing students, updating records, etc.
Web and Mobile Application Development (WMAD): Day 21 - Day 35
Work Done:
Work Done:
html
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph of text.</p>
</body>
</html>
Work Done:
html
Copy code
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Styled Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Styled Web Page</h1>
<p>This paragraph is styled using CSS.</p>
</body>
</html>
css
Copy code
/* styles.css */
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
}
h1 {
color: #007BFF;
}
p {
font-size: 18px;
}
Work Done:
html
Copy code
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript Interaction</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>JavaScript Interaction</h1>
<button onclick="showAlert()">Click Me</button>
<script>
function showAlert() {
alert('Button Clicked!');
}
</script>
</body>
</html>
html
Copy code
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Layout</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
</div>
</body>
</html>
css
Copy code
/* styles.css */
.container {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.box {
background-color: #007BFF;
color: white;
padding: 20px;
margin: 10px;
flex: 1 1 200px; /* Grow, shrink, basis */
text-align: center;
}
Work Done:
bash
Copy code
npx create-react-app my-react-app
cd my-react-app
npm start
jsx
Copy code
// src/App.js
import React from 'react';
function App() {
return (
<div className="App">
<header className="App-header">
<h1>Welcome to React</h1>
<p>This is a basic React application.</p>
</header>
</div>
);
}
Work Done:
jsx
Copy code
// src/App.js
import React, { useState } from 'react';
function App() {
const [input, setInput] = useState('');
return (
<div className="App">
<header className="App-header">
<h1>React State Management</h1>
<input type="text" value={input} onChange={handleChange} />
<p>You typed: {input}</p>
</header>
</div>
);
}
Work Done:
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT_ID.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT_ID.appspot.com",
messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
appId: "YOUR_APP_ID"
};
Work Done:
bash
Copy code
flutter create my_flutter_app
cd my_flutter_app
flutter run
dart
Copy code
// lib/main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
Work Done:
dart
Copy code
// lib/main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
Work Done:
dart
Copy code
// lib/main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
Work Done:
dart
Copy code
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
void main() {
runApp(MyApp());
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Data from API')),
body: FutureBuilder<List<String>>(
future: fetchData(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else {
final data = snapshot.data!;
return ListView.builder(
itemCount: data.length,
itemBuilder: (context, index) {
return ListTile(title: Text(data[index]));
},
);
}
},
),
);
}
}
Work Done:
bash
Copy code
flutter pub add firebase_messaging
dart
Copy code
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
@override
void initState() {
super.initState();
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
// Handle message when app is in foreground
print('Message received: ${message.notification?.title}');
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Push Notifications')),
body: Center(child: Text('You will receive push notifications here')),
);
}
}
Work Done:
bash
Copy code
npm install -g firebase-tools
firebase login
firebase init
# Choose Hosting, select project, and deploy
firebase deploy
Day 35: Mobile App Deployment
Work Done:
Configured the Flutter project for release mode and deployed to an emulator or connected device.
bash
Copy code
flutter build apk --release
flutter install