1 question -Here's how you can perform these tasks in SQL: ### 1. Create the `Student_info` Table ```sql CREATE TABLE Student_info ( rollno INT PRIMARY KEY, studname VARCHAR(50), age INT, department VARCHAR(50), lastexampercent DECIMAL(5, 2) ); ``` ### 2. Insert Records ```sql INSERT INTO Student_info (rollno, studname, age, department, lastexampercent) VALUES (1, 'John', 20, 'Computer Science', 85.5), (2, 'Alice', 22, 'Mathematics', 90.0), (3, 'Bob', 21, 'Physics', 78.5); ``` ### 3. View Records of Students with Roll Numbers 1, 2, and 3 ```sql SELECT * FROM Student_info WHERE rollno IN (1, 2, 3); ``` ### 4. Create an Index on the `studname` Column ```sql CREATE INDEX idx_studname ON Student_info (studname); ``` ### 5. Display the Records with a Limit of 2 Results ```sql SELECT * FROM Student_info LIMIT 2; ``` ### 6. Add a New Column `address` to the `Student_info` Table ```sql ALTER TABLE Student_info ADD addre...
Games :- A. Create a collection called ‘games’. We’re going to put some games in it. Creation - db.createCollection('games'); B. Add 5 games to the database. Give each document the following properties: name, genre, rating (out of 100) If you make some mistakes and want to clean it out, use remove()on your collection. Insertion - db.games.insertMany([ { name: "The Legend of Zelda: Breath of the Wild", genre: "Action-Adventure", rating: 97, achievements: {} }, { name: "Hollow Knight", genre: "Metroidvania", rating: 90, achievements: {} }, { name: "Celeste", genre: "Platformer", rating: 94, achievements: {} }, { name: "God of War", genre: "Action", rating: 93, achievements: {} }, { name: "Stardew Valley", genre: "Simulation", rating: 89, achievements: {} } ]); C. Write a query that returns all the games db.ga...
Comments
Post a Comment