Soru
8. Create a table named "Students" with the following columns: StudentID (integer) FirstName (varchar.maximum length 50) LastName (varchar maximum length 50) BirthDate (date) Major (varchar maximum length 100) 9. Insert two sample rows into the "Students" table with diverse information. fort Name last Nam 10. Write a query to add a new column named "Nationality" with a data type of VARCHAR (20) to the "Students "table.
Çözüm
4.7274 Voting
Janset
Usta · 5 yıl öğretmeniUzman doğrulaması
Cevap
8. Here is the SQL code to create the "Students" table with the specified columns:<br />```sql<br />CREATE TABLE Students (<br /> StudentID INT,<br /> FirstName VARCHAR(50),<br /> LastName VARCHAR(50),<br /> BirthDate DATE,<br /> Major VARCHAR(100)<br />);<br />```<br />9. Here is the SQL code to insert two sample rows into the "Students" table:<br />```sql<br />INSERT INTO Students (StudentID, FirstName, LastName, BirthDate, Major)<br />VALUES<br /> (1, 'John', 'Doe', '1990-01-01', 'Computer Science'),<br /> (2, 'Jane', 'Smith', '1995-05-05', 'Biology');<br />```<br />10. Here is the SQL code to add a new column named "Nationality" with a data type of VARCHAR(20) to the "Students" table:<br />```sql<br />ALTER TABLE Students<br />ADD Nationality VARCHAR(20);<br />```
Derecelendirmek için tıklayın: