Skip to content

Commit

Permalink
fix(template): remove excess codes from sql sample
Browse files Browse the repository at this point in the history
  • Loading branch information
HamidMolareza committed Nov 2, 2024
1 parent 87e4ac9 commit 07966f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
2 changes: 2 additions & 0 deletions Templates/csharp-sql/CsharpSql/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// return;
// static IQueryable<object> Solution() {
// var db = new AppDbContext();

// var result = from person in db.People
// join address in db.Addresses
// on person.PersonId equals address.PersonId into addrGroup
Expand All @@ -28,5 +29,6 @@
// City = address.City,
// State = address.State
// };

// return result;
// }
28 changes: 2 additions & 26 deletions Templates/csharp-sql/solution.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,12 @@ use LeetCode;
go

-- create tables
create table Person
(
personId int primary key,
lastName varchar(255),
firstName varchar(255)
);

create table Address
(
addressId int primary key,
personId int,
city varchar(255),
state varchar(255)
);


-- insert sample data
insert into Person (personId, lastName, firstName)
values (1, 'Smith', 'John'),
(2, 'Johnson', 'Jane'),
(3, 'Williams', 'Alice');

insert into Address (addressId, personId, city, state)
values (1, 1, 'New York', 'NY'),
(2, 2, 'Los Angeles', 'CA');
go


-- Solution
select p.firstName, p.lastName, a.city, a.state
from Person p
left join Address a on p.personId = a.personId;


-- switch to master before drop
Expand Down

0 comments on commit 07966f9

Please sign in to comment.