Curriculum
Course: Data Analysis
Login
Text lesson

How to bring data base files into data base in SQL and How to delete a column in SQL

 

HOW TO BRING IN NEW DATA ON EXCEL FILE INTO SQL

 First open your SQL Server and right click database and click new database, a dialogue box will appear, name your data base (e.g KC) and click Ok.

Next is to bring table inside the new database created. Right click database and scroll to task and click import data and click next then select data source. Browse to get your data file, click next and pick destination as SQL server and click next.

 

How to delete a column in SQL

Deleting a column in SQL is one of the most common operations when dealing with a database. For this reason, knowing how to properly delete a column in SQL is critical. Without the right procedures and precautions, you could run into data integrity and data loss issues.

What Does it Mean to Delete a Column in SQL?

In SQL, deleting a column refers to the process of permanently removing a specific column from a table. All data associated with the column will be removed from the disk. Similarly, the column’s metadata will be removed from the table’s schema. When you delete a column, you essentially eliminate its existence within the table structure. The column will be no longer available for queries and its data will be lost.

Alter table [table_Name]

Drop Column [column name]

Example

ALTER TABLE [dbo].[Student_information]

DROP COLUMN State

 

Can use one Query to delete multiple columns

Alter Table [Table Name]

Drop Column [Column 1 Name]

Drop Column [column 2 Name]

Drop Column [Column 3 Name]

 

HOW TO DELETE SINGLE INFO FROM A COLUMN IN A TABLE WITHOUT AFFECTING OTHER INFO

Example

UPDATE [dbo].[Pupils_information]

SET [dbo].[Pupils_information].Age = 11

WHERE [dbo].[Pupils_information].Name = ‘Martins Ogbodo’