📺 Develpreneur YouTube Episode

Video + transcript

SQL tutorial - Coding Standards

2022-08-11 •Youtube

Detailed Notes

1. Standards 2. Tables names 3. Column names 4. Ids and keys 5. Stored Procedures 6. Functions 7. Parameters and variables.

Transcript Text
[Music]
well hello and welcome back we're
continuing our season where we're
looking at my sequel uh tutorial type
things
and we're sort of getting to the the
end of some of the things i wanted to
cover
we've gotten through a lot of basics
one of the things we have not talked
about is names and naming standards
i want to spend a little time on these
because it is something that does matter
and is very helpful particularly when
you start getting into larger
databases as in
a large number of tables or a large
number of stored procedures
or even complicated stored procedures
because it's
very much like
coding in general you want people people
to be able to jump in and
have some
clue about what you're doing and where
things are
the first thing i want to look at is
table names
and whoop let me flip back over here
there are a couple of different ways to
do it
the first one to look at here show you
this is
this list here
are tables that are generated by uh
django
sort of the way it
builds stuff by default you build out
models it's got its own little structure
and then based on the names of classes
and objects
it builds out table names
the thing that's worth considering
um and that they do is one is if you
look you have like these
you know the auth underscores and you
have these django underscores and rss
app is the name of the application
itself
so in this case you have some
these auth tables are for
data around authorization
the django are around its
its internal storage and things like
that
and then you have the application tables
which have all of their various you know
names and organization
now the nice thing about the thing about
with table names
is that you're probably going to see
them in a list like this i mean even if
i do like show tables
over here
let me see this long list now in this
case they're not
you know they're not ordered or anything
like that
um
but normally i'm going to see it in some
way that's going to be ordered probably
by name
but i can also do some things that i can
look for names based on
uh based on like a string within the
name in particular
it's nice to have things grouped uh for
example here i've got these
feed related things are all together
because they're the app and then feed
i use lkp for lookups but i've seen
uh xref i've seen a lot of sometimes
just l or list or things like that for
uh you know look up or
relational type stuff like if i look at
the data here it's just got you know a
couple different little records and this
is just as a
sort of like a category type field
sometimes it starts with cat
but what that does is that pushes those
together
when you're looking at a list and it
makes it easier to find what you're
looking for particularly you know like
if you look here and i've granted this
is all databases but if these were
columns you know it can get
it could get long fast
and so in this case
that's uh or in a case when you're using
you know these correctly like here these
are these are all the
things that come off of a user
then you can group them by name so you
want to
be consistent is really the key
so that it
if somebody's looking for something
they're going to be able to see it you
know for example like user you know
maybe you start with a there's a user
table
and then there's user address user
contact user
blah blah blah
so you'll all you know be able to see oh
user and then here are the things that
are the
um the sort of the details or the
relationships that come off of that
that's not always easy you know it's not
always possible like in this case
we have feeds
and then we have users but you don't
have feed user
instead you have user feed but at least
you know between the two you can pick
one of them
now in this case what django does is it
uses all lowercase
and
underscores to separate things to sort
you know to highlight where the
differences are slightly different
approach that you can take which i did
which was not as consistent here you can
see these lkps do not start with a
capital l
which originally was done in hopes that
those would all float to the top because
they would be lower case or float to the
bottom
didn't quite work out
but these use um other than that they
use camelcase
which can be useful to you know when you
get into something that's a little
longer name then you can do three or
four words and it's still
sort of easy to pick them out
but
then you run into case sensitivity
issues sometimes with the database with
the sql
so it's actually would be easier to
instead of using camel case is use you
know underscores or something along
those lines so that you separate the
words and make it very easy then to read
particularly if you look here if these
were all underscores
instead of being pushed together it
would be feed feed underscore item feed
underscore out feed underscore out
underscore item
and so you'd be able to see you know
you'd see a list of names so um
let me just pick like oh i just do this
so you'd be see table like user and then
you'd see user
address
user
address
uh
let's say
i don't know why i want to do that but
let's say user contact and these would
not necessarily in order
uh
user
employer
user employer
i don't know details you know something
like that
just throwing a few of these together so
you could pretty quickly see that hey
this is the user but here these are user
things
and sometimes you'd see something like
user
user contact
use your contact
phone
here's your contact email you know
something like that that would even be
details off of a detail if you get
really complex and you know sort of long
complicated names
so there's something that is depending
on the language you're working in stuff
like that you may be very used to camel
case however
that can cause some you know some issues
particularly
when you get into aliasing things
because
depending on how you alias stuff you
know if it's case sensitive you can get
confusing quickly
uh which sometimes makes it
within your aliasing
useful to you know say so if i wanted to
do
uh
let's say from here
let me go to this guy where's our rss
reader so if i go from here
and let's just do select star from
uh
let's do our session
feed so
here
uh when i'm doing that
if i wanted to do
i could do like rf and so it'd be nice
in lowercase and then it's just rf dot
there
and then i've got my alias or you know
if i do as but if i do or maybe i want
to be consistent always going to do it's
my aliases are always going to be all
cap
if i'm case sensitive then that also is
is you know pretty readable and actually
would fit with most people would do it
like this they keep all of the keywords
all capped so that may or may not be an
issue oh you may also do like let me
call this like i'll start everything
with an a so it'd be alias
or maybe an a underscore even and so now
i could see real easy that i've got this
oh this
a underscore is an alias and then i can
go find that somewhere in there so when
you're thinking about it
as far as trying to set some sort of a
standard
um think about what
how you want to do it with aliases as
well
and again the key to this
is that it's a standard and it's
something you stick with
if you bounce around this could be
really hard to
to read your code
that's tables
with names typically
the way a table is done
is that it doesn't have an s at the end
because each row is one thing by
it's almost by default
they should all have s's because they're
all going to have multiple records
but
uh that is not always held uh you know
for example here and the way they did it
with django is it's you know you have
group
but you have group permissions because
that's basically pointing back to say
that it is a mini to one relationship
um
and so you've got you know so a user
there can be multiple groups assigned to
a user
um the admin log it's just your normal
log records um where they've got the s's
typically is you know it has its own
inner meaning
but that can be sort of complex to
nuanced and
it's usually easier to just say
you know i'm a uh this is what i you
know
we're either we're always singles or
always doubles another thing is
ids
it is easiest
i think
well one you should always have we've
talked about this you should always have
a single primary key that is not
that is just some generated number has
nothing to do with the data that way if
the data changes the id never needs to
change then you should always be able
then to find that record but based on
that id that id will always forever go
to that record unless it gets deleted
now
some places like
sometimes it's a table name underscore
id so in this case it'd be like
rss app underscore lookup target
underscore id
it's easier for it to just be id
everywhere because then you don't have
to worry about you know did they how did
they do it based on the
table name
um
the issue the and that means that every
table when you have an id you know that
that's that
record that table's id
you may also do a pk so it'd be like pk
underscore
id or something like that to say it's a
primary key
the
the challenge sometimes get when you
have when you call it id
is when you're using foreign keys
because then it becomes inconsistent so
if i go here and i've got
um
let's see
let me do this
so
like if i take
user q i don't even know what user q is
oh i did but uh let me go actually flip
to this guy let me go over to this one
because it's got less data
and it has a slightly different approach
so here
like this one is now instead of using id
i actually use the table name and the
the column because when you get into
foreign keys like you do here
this contract has an id so that's the
primary key for that row
but then it also has foreign keys out to
a performer in the performance table
and so i can go to that performer id is
going to be equal to performer id in
this table so sometimes it's nice to
do table id or table name with id or
some
designator that's the primary key so
that you can actually keep the column
names uh they'll be simple you know so
if i wanted to link i could do
um
select star from contract oops except
for it's probably capital c
and then enter join
performer
on
contract dot
performer
id
equals
perform performer
dot performer id so it's the same
whoops
so i'm using that same column name in
each and then that's going to link those
together of course don't have any
records so it doesn't help but
that can be
a useful kind of thing is to just say
okay i should be able to find that and
it's useful without looking at
relationships or keys or anything else
because you say hey if i've got a
performance id you can look at that
which i did
i didn't even know but i and looking at
those i said oh then that means since
this is performer id this links to the
performer table the id and the performer
table this performance links to the the
id and the performance table
so doing those
using those sorts of
name standards can make it really easy
to see relationships without having to
deal with keys and things of that nature
now when you get into
foreign keys and primary keys and
indexes and things of those natures
it's
one most places most databases they have
to be unique within the system thus and
i think we've mentioned this it really
makes sense for your keys to be the uh
usually to be the table name
and then
the uh
the column name or the index the yeah
the column name that it's on now in this
case like see this one doesn't have to
have it so it has performance id but if
you look at performance
um
it has a primary
and so it's like this one's not i'm not
seeing name collisions uh
i don't think anywhere
um
i may have just lucked out but i don't
think i'm going to see anything oops
indexes
uh preference type remember yeah so
there's probably going to be a bunch of
member ids maybe not
uh well i'm sort of looking right but i
may have looked out that these had oh
and i wonder if these are actual names
but
in order to make it uh
unique typically what you would do is
like if i wanted to create an index on
the final field in contract
then you know i'd be create index
uh
contract
final
on
contract
final something like that and then it's
like again it's very easy when you look
at an index to figure out where it's at
so if you start
having issues if you have some sort of
index
error that comes back you know
particularly unique and stuff like that
you can tell oh it's on the contract
table i've got to go look at the final
column and i'll and actually i can look
in these indexes on this table
and i'll be able to see what that one is
and see why there's an issue with it
or
if you're try if your performance
going through some performance
improvements then you can see which
indexes are being used
for stored procedures and functions um
much like
functions and usually like you get
you're going to want to sort of mirror
probably the primary language that's
using it so
whether it's camel case or whether it's
lowercase or uppercase
a thing to remember with functions is
they're going to be
potentially used quite a bit within
queries
so you want you really want to avoid
like huge
obnoxious function name length
stored procedures you're going to like
you know you may be select you know star
from my big procedure name and then give
it some some parameters
the function may exist in 10 different
places because a function could be
things like uh force things to uppercase
so if i have to do that for five fields
in a table and my name my function name
is force all of the characters in this
two uppercase that's a long name and
it's really annoying to write that
several times
so you want it to be meaningful but
concise
and you might even do some uh it but you
got to be consistent maybe and do a
little bit of abbreviations and things
like that
just to make it a little easier to use
and again you're going to want to do
some sort of in the same vein as tables
with stored procedures and functions you
want to you know ideally
order the words within the name
so that they are grouped if they are
similars
for example with store procedures a lot
of times it makes sense to
start with the primary table name that
it works on
and then that will you know when you
sort them it will group all of those
together
not to mention just you know makes
things look a little better when it's
consistent
and you're going to run into the same
things whether you want them all lower
case or camel case or upper case
just
be consistent in how you do it
and then with parameters and variables
again
those are all over the place
as far as you know the companies and
organizations i've worked with so i
think it's just
pick something
uh some place it's just like variable
names in any other language sometimes
people want to precede them
uh have some sort of prefix that says
what type it is you know like all the
integers would start with a lowercase i
all the
strings would start with the lowercase s
or the var chars and you know may start
with a lowercase b things like that
um
just
find a way to be consistent or check
your you know if you're an organization
ask if they have a standards document
and
you know either go by that or if it's
missing some stuff if it has gaps don't
be afraid to say hey this there's a
couple things i have questions about why
don't we create standards for those as
well
now i i know i've gotten a little just
theoretical a little bit i guess in this
a little more academic but i think it's
important to think about these things as
we're getting into database development
in particular
so i think i'll just sort of uh stop
beating the dead horse now and wrap this
one up
and let you get back to your day so go
out there and have yourself a great day
a great week and we will talk to you
next time
you
Transcript Segments
0.43

[Music]

27.199

well hello and welcome back we're

29.199

continuing our season where we're

30.48

looking at my sequel uh tutorial type

33.84

things

35.12

and we're sort of getting to the the

38.079

end of some of the things i wanted to

39.68

cover

40.719

we've gotten through a lot of basics

43.2

one of the things we have not talked

44.48

about is names and naming standards

48.559

i want to spend a little time on these

50

because it is something that does matter

53.84

and is very helpful particularly when

56.399

you start getting into larger

58.64

databases as in

60.559

a large number of tables or a large

64.4

number of stored procedures

67.52

or even complicated stored procedures

70.08

because it's

71.28

very much like

73.04

coding in general you want people people

75.04

to be able to jump in and

77.439

have some

78.96

clue about what you're doing and where

80.72

things are

82

the first thing i want to look at is

84.08

table names

87.68

and whoop let me flip back over here

91.28

there are a couple of different ways to

92.64

do it

93.92

the first one to look at here show you

95.84

this is

97.6

this list here

99.439

are tables that are generated by uh

102.56

django

103.84

sort of the way it

105.6

builds stuff by default you build out

107.84

models it's got its own little structure

109.439

and then based on the names of classes

112.079

and objects

113.52

it builds out table names

116.399

the thing that's worth considering

119.28

um and that they do is one is if you

121.84

look you have like these

123.759

you know the auth underscores and you

125.439

have these django underscores and rss

128.08

app is the name of the application

129.92

itself

131.52

so in this case you have some

134.16

these auth tables are for

136.879

data around authorization

138.959

the django are around its

141.76

its internal storage and things like

144.72

that

145.68

and then you have the application tables

148.56

which have all of their various you know

150.879

names and organization

152.64

now the nice thing about the thing about

154.879

with table names

156.64

is that you're probably going to see

158.4

them in a list like this i mean even if

160.48

i do like show tables

162.879

over here

164.16

let me see this long list now in this

166.64

case they're not

168.4

you know they're not ordered or anything

170.319

like that

171.519

um

172.48

but normally i'm going to see it in some

174.48

way that's going to be ordered probably

175.84

by name

177.599

but i can also do some things that i can

179.92

look for names based on

182.319

uh based on like a string within the

184.64

name in particular

186.64

it's nice to have things grouped uh for

190

example here i've got these

192.4

feed related things are all together

194.4

because they're the app and then feed

197.44

i use lkp for lookups but i've seen

201.2

uh xref i've seen a lot of sometimes

203.84

just l or list or things like that for

208.4

uh you know look up or

210.64

relational type stuff like if i look at

212.4

the data here it's just got you know a

214.56

couple different little records and this

216.319

is just as a

217.76

sort of like a category type field

219.2

sometimes it starts with cat

221.36

but what that does is that pushes those

223.44

together

224.56

when you're looking at a list and it

226

makes it easier to find what you're

227.68

looking for particularly you know like

229.599

if you look here and i've granted this

230.72

is all databases but if these were

232.319

columns you know it can get

234.08

it could get long fast

237.04

and so in this case

238.72

that's uh or in a case when you're using

241.12

you know these correctly like here these

242.64

are these are all the

244.72

things that come off of a user

246.879

then you can group them by name so you

249.439

want to

250.48

be consistent is really the key

253.439

so that it

254.48

if somebody's looking for something

255.84

they're going to be able to see it you

257.519

know for example like user you know

259.44

maybe you start with a there's a user

261.68

table

262.639

and then there's user address user

264.88

contact user

266.72

blah blah blah

269.12

so you'll all you know be able to see oh

270.8

user and then here are the things that

272.639

are the

274

um the sort of the details or the

276.24

relationships that come off of that

278.88

that's not always easy you know it's not

280.24

always possible like in this case

282.479

we have feeds

283.919

and then we have users but you don't

286

have feed user

287.84

instead you have user feed but at least

290.4

you know between the two you can pick

292.16

one of them

293.68

now in this case what django does is it

295.6

uses all lowercase

297.44

and

298.32

underscores to separate things to sort

300.88

you know to highlight where the

302.639

differences are slightly different

304.479

approach that you can take which i did

307.12

which was not as consistent here you can

309.039

see these lkps do not start with a

311.12

capital l

313.28

which originally was done in hopes that

315.44

those would all float to the top because

317.52

they would be lower case or float to the

319.28

bottom

320.479

didn't quite work out

322.8

but these use um other than that they

325.44

use camelcase

327.039

which can be useful to you know when you

329.44

get into something that's a little

330.639

longer name then you can do three or

332.88

four words and it's still

334.96

sort of easy to pick them out

336.72

but

337.6

then you run into case sensitivity

339.759

issues sometimes with the database with

341.68

the sql

342.96

so it's actually would be easier to

344.96

instead of using camel case is use you

347.44

know underscores or something along

349.52

those lines so that you separate the

351.199

words and make it very easy then to read

354.24

particularly if you look here if these

356.24

were all underscores

358

instead of being pushed together it

359.36

would be feed feed underscore item feed

361.919

underscore out feed underscore out

363.6

underscore item

365.12

and so you'd be able to see you know

367.36

you'd see a list of names so um

371.52

let me just pick like oh i just do this

377.919

so you'd be see table like user and then

380.4

you'd see user

382.16

address

383.919

user

385.12

address

387.039

uh

388.88

let's say

390.88

i don't know why i want to do that but

392.08

let's say user contact and these would

394.72

not necessarily in order

396.4

uh

397.28

user

400.319

employer

402.56

user employer

406.479

i don't know details you know something

408.319

like that

409.919

just throwing a few of these together so

411.36

you could pretty quickly see that hey

412.8

this is the user but here these are user

416.56

things

417.84

and sometimes you'd see something like

419.28

user

420.8

user contact

423.039

use your contact

424.639

phone

429.68

here's your contact email you know

432.16

something like that that would even be

433.919

details off of a detail if you get

436.72

really complex and you know sort of long

438.72

complicated names

440.72

so there's something that is depending

442.479

on the language you're working in stuff

443.68

like that you may be very used to camel

445.28

case however

447.039

that can cause some you know some issues

449.12

particularly

450.639

when you get into aliasing things

453.599

because

454.88

depending on how you alias stuff you

456.88

know if it's case sensitive you can get

458.88

confusing quickly

460.88

uh which sometimes makes it

463.039

within your aliasing

464.879

useful to you know say so if i wanted to

467.36

do

468.56

uh

469.84

let's say from here

472.879

let me go to this guy where's our rss

475.919

reader so if i go from here

478.639

and let's just do select star from

482.56

uh

484.8

let's do our session

490.84

feed so

492.8

here

493.759

uh when i'm doing that

496.08

if i wanted to do

497.52

i could do like rf and so it'd be nice

499.599

in lowercase and then it's just rf dot

501.84

there

502.72

and then i've got my alias or you know

504.879

if i do as but if i do or maybe i want

507.919

to be consistent always going to do it's

509.52

my aliases are always going to be all

511.039

cap

512.88

if i'm case sensitive then that also is

515.12

is you know pretty readable and actually

517.2

would fit with most people would do it

519.36

like this they keep all of the keywords

525.12

all capped so that may or may not be an

527.519

issue oh you may also do like let me

529.36

call this like i'll start everything

530.56

with an a so it'd be alias

532.88

or maybe an a underscore even and so now

535.76

i could see real easy that i've got this

538.64

oh this

539.76

a underscore is an alias and then i can

542.32

go find that somewhere in there so when

544.399

you're thinking about it

546.16

as far as trying to set some sort of a

547.76

standard

548.8

um think about what

550.64

how you want to do it with aliases as

552.959

well

553.839

and again the key to this

555.76

is that it's a standard and it's

558

something you stick with

559.519

if you bounce around this could be

561.2

really hard to

563.68

to read your code

565.2

that's tables

567.04

with names typically

570.399

the way a table is done

572.399

is that it doesn't have an s at the end

575.279

because each row is one thing by

578.16

it's almost by default

580.399

they should all have s's because they're

581.76

all going to have multiple records

583.92

but

584.88

uh that is not always held uh you know

588.24

for example here and the way they did it

591.279

with django is it's you know you have

593.92

group

594.88

but you have group permissions because

596.399

that's basically pointing back to say

598.24

that it is a mini to one relationship

602.16

um

603.6

and so you've got you know so a user

605.839

there can be multiple groups assigned to

607.519

a user

608.56

um the admin log it's just your normal

611.36

log records um where they've got the s's

614.32

typically is you know it has its own

617.2

inner meaning

619.279

but that can be sort of complex to

620.72

nuanced and

622.48

it's usually easier to just say

625.279

you know i'm a uh this is what i you

627.76

know

628.64

we're either we're always singles or

630.399

always doubles another thing is

633.2

ids

635.76

it is easiest

637.76

i think

639.12

well one you should always have we've

640.399

talked about this you should always have

641.6

a single primary key that is not

644

that is just some generated number has

646.32

nothing to do with the data that way if

648.399

the data changes the id never needs to

650.24

change then you should always be able

652

then to find that record but based on

654.079

that id that id will always forever go

656.56

to that record unless it gets deleted

660.079

now

661.04

some places like

662.8

sometimes it's a table name underscore

665.36

id so in this case it'd be like

668.24

rss app underscore lookup target

670.24

underscore id

672.64

it's easier for it to just be id

674.8

everywhere because then you don't have

676.72

to worry about you know did they how did

679.12

they do it based on the

681.36

table name

682.88

um

683.92

the issue the and that means that every

686.079

table when you have an id you know that

688.16

that's that

689.519

record that table's id

692.079

you may also do a pk so it'd be like pk

694.72

underscore

696.24

id or something like that to say it's a

697.76

primary key

699.92

the

700.959

the challenge sometimes get when you

702.32

have when you call it id

704.64

is when you're using foreign keys

706.959

because then it becomes inconsistent so

709.04

if i go here and i've got

711.68

um

712.639

let's see

715.2

let me do this

717.44

so

719.04

like if i take

721.76

user q i don't even know what user q is

723.839

oh i did but uh let me go actually flip

726.32

to this guy let me go over to this one

728.16

because it's got less data

741.92

and it has a slightly different approach

744.72

so here

746.079

like this one is now instead of using id

748.16

i actually use the table name and the

750.32

the column because when you get into

753.279

foreign keys like you do here

755.839

this contract has an id so that's the

757.92

primary key for that row

760.079

but then it also has foreign keys out to

762

a performer in the performance table

765.279

and so i can go to that performer id is

768.48

going to be equal to performer id in

770.8

this table so sometimes it's nice to

773.519

do table id or table name with id or

776.88

some

777.92

designator that's the primary key so

780.079

that you can actually keep the column

782.32

names uh they'll be simple you know so

784.399

if i wanted to link i could do

787.44

um

788.56

select star from contract oops except

791.92

for it's probably capital c

795.76

and then enter join

799.6

performer

801.92

on

803.68

contract dot

805.76

performer

807.44

id

808.639

equals

810.88

perform performer

813.279

dot performer id so it's the same

816.16

whoops

817.04

so i'm using that same column name in

819.199

each and then that's going to link those

820.24

together of course don't have any

821.68

records so it doesn't help but

825.44

that can be

826.88

a useful kind of thing is to just say

828.48

okay i should be able to find that and

829.839

it's useful without looking at

832.24

relationships or keys or anything else

834.079

because you say hey if i've got a

835.199

performance id you can look at that

836.88

which i did

838.16

i didn't even know but i and looking at

840.16

those i said oh then that means since

842.16

this is performer id this links to the

844.16

performer table the id and the performer

846.32

table this performance links to the the

850.16

id and the performance table

853.44

so doing those

855.44

using those sorts of

858.399

name standards can make it really easy

860.399

to see relationships without having to

862.56

deal with keys and things of that nature

865.76

now when you get into

867.92

foreign keys and primary keys and

869.68

indexes and things of those natures

872.56

it's

873.6

one most places most databases they have

876.24

to be unique within the system thus and

879.12

i think we've mentioned this it really

880.959

makes sense for your keys to be the uh

884.399

usually to be the table name

886.88

and then

888.72

the uh

890.079

the column name or the index the yeah

892.32

the column name that it's on now in this

894.399

case like see this one doesn't have to

896.48

have it so it has performance id but if

898.88

you look at performance

901.279

um

902.72

it has a primary

904.48

and so it's like this one's not i'm not

906.24

seeing name collisions uh

908.32

i don't think anywhere

911.36

um

913.04

i may have just lucked out but i don't

915.36

think i'm going to see anything oops

917.44

indexes

919.36

uh preference type remember yeah so

921.04

there's probably going to be a bunch of

922.32

member ids maybe not

929.68

uh well i'm sort of looking right but i

932

may have looked out that these had oh

933.68

and i wonder if these are actual names

935.44

but

936.72

in order to make it uh

938.88

unique typically what you would do is

940.639

like if i wanted to create an index on

942.48

the final field in contract

945.36

then you know i'd be create index

949.36

uh

950.48

contract

952.72

final

954.32

on

956.24

contract

957.759

final something like that and then it's

960

like again it's very easy when you look

961.839

at an index to figure out where it's at

963.36

so if you start

964.72

having issues if you have some sort of

966.56

index

967.759

error that comes back you know

969.6

particularly unique and stuff like that

971.36

you can tell oh it's on the contract

973.12

table i've got to go look at the final

974.959

column and i'll and actually i can look

976.56

in these indexes on this table

979.12

and i'll be able to see what that one is

980.639

and see why there's an issue with it

983.68

or

984.56

if you're try if your performance

987.199

going through some performance

988.24

improvements then you can see which

990.24

indexes are being used

994.16

for stored procedures and functions um

997.519

much like

998.72

functions and usually like you get

1000.56

you're going to want to sort of mirror

1002

probably the primary language that's

1003.839

using it so

1005.92

whether it's camel case or whether it's

1008.72

lowercase or uppercase

1010.72

a thing to remember with functions is

1012.8

they're going to be

1014.16

potentially used quite a bit within

1016.079

queries

1017.12

so you want you really want to avoid

1019.279

like huge

1020.72

obnoxious function name length

1023.12

stored procedures you're going to like

1024.559

you know you may be select you know star

1027.28

from my big procedure name and then give

1030

it some some parameters

1032.64

the function may exist in 10 different

1034.4

places because a function could be

1036.319

things like uh force things to uppercase

1039.679

so if i have to do that for five fields

1042.4

in a table and my name my function name

1044.559

is force all of the characters in this

1047.36

two uppercase that's a long name and

1049.84

it's really annoying to write that

1051.12

several times

1052.48

so you want it to be meaningful but

1054.24

concise

1055.76

and you might even do some uh it but you

1058.72

got to be consistent maybe and do a

1061.039

little bit of abbreviations and things

1063.12

like that

1065.12

just to make it a little easier to use

1067.679

and again you're going to want to do

1069.12

some sort of in the same vein as tables

1072.799

with stored procedures and functions you

1074.799

want to you know ideally

1076.96

order the words within the name

1079.919

so that they are grouped if they are

1082.16

similars

1083.44

for example with store procedures a lot

1085.12

of times it makes sense to

1087.52

start with the primary table name that

1089.76

it works on

1091.12

and then that will you know when you

1092.559

sort them it will group all of those

1094.799

together

1096.72

not to mention just you know makes

1098.16

things look a little better when it's

1099.36

consistent

1100.96

and you're going to run into the same

1101.84

things whether you want them all lower

1103.12

case or camel case or upper case

1105.76

just

1106.799

be consistent in how you do it

1111.6

and then with parameters and variables

1115.2

again

1116.64

those are all over the place

1118.4

as far as you know the companies and

1120.24

organizations i've worked with so i

1121.76

think it's just

1123.6

pick something

1124.72

uh some place it's just like variable

1126.48

names in any other language sometimes

1128.32

people want to precede them

1130.24

uh have some sort of prefix that says

1131.76

what type it is you know like all the

1133.44

integers would start with a lowercase i

1135.28

all the

1136.559

strings would start with the lowercase s

1138.48

or the var chars and you know may start

1140.4

with a lowercase b things like that

1144.16

um

1144.96

just

1146.24

find a way to be consistent or check

1149.039

your you know if you're an organization

1151.12

ask if they have a standards document

1152.88

and

1154

you know either go by that or if it's

1155.76

missing some stuff if it has gaps don't

1157.44

be afraid to say hey this there's a

1159.12

couple things i have questions about why

1160.48

don't we create standards for those as

1162.84

well

1164.64

now i i know i've gotten a little just

1167.2

theoretical a little bit i guess in this

1168.72

a little more academic but i think it's

1170.96

important to think about these things as

1173.919

we're getting into database development

1176

in particular

1177.52

so i think i'll just sort of uh stop

1180

beating the dead horse now and wrap this

1182.4

one up

1183.6

and let you get back to your day so go

1185.36

out there and have yourself a great day

1187.039

a great week and we will talk to you

1190.08

next time

1207.44

you